Handling exceptions in reflexive extension functions

If a Java extension function throws an exception, the exception can be caught using the try/catch facilities in XQuery 3.0 and XSLT 3.0.

The exception triggers a dynamic error, whose details are derived from the exception details:

Note that this applies to cases where the extension function is successfully called, and the called function throws an exception. Failures to invoke the extension function are mapped to Saxon error codes and the original Java exception is not directly available.