| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.s9api; |
| 9 | |
| 10 | /** |
| 11 | * An unchecked exception thrown by the Saxon API. Unchecked exceptions are used only when errors occur in a method |
| 12 | * for which the interface specification defines no checked exception, for example {@link java.util.Iterator#next()}. |
| 13 | * The exception always wraps some underlying exception, which can be retrieved using {@link #getCause()} |
| 14 | */ |
| 15 | public class SaxonApiUncheckedException extends RuntimeException { |
| 16 | |
| 17 | /** |
| 18 | * Create an unchecked exception |
| 19 | * |
| 20 | * @param err the underlying cause |
| 21 | */ |
| 22 | |
| 23 | public SaxonApiUncheckedException(Throwable err) { |
| 24 | super(err); |
| 25 | } |
| 26 | |
| 27 | |
| 28 | /** |
| 29 | * Returns the detail message string of this throwable. |
| 30 | * |
| 31 | * @return the detail message string of this <tt>Throwable</tt> instance |
| 32 | * (which may be <tt>null</tt>). |
| 33 | */ |
| 34 | public String getMessage() { |
| 35 | return getCause().getMessage(); |
| 36 | } |
| 37 | } |