SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
The XPath API
Standards Conformance
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
XSLT Patterns

# fn:error

fn:error()

Function signature

Result |

Raises an error.

XPath 2.0 Specification

fn:error($error as xs:QName?)

Function signature

Result |

XPath 2.0 Specification

Raises an error.

Saxon allows the first argument to be an empty sequence, treating this as equivalent to calling fn:error() with no arguments. The error code (local part and namespace URI part) is recorded as part of the exception that's supplied to a user-defined JAXP `ErrorListener`, or that is returned to the calling application. The code is also available to the `catch` part of a call on the `saxon:try` extension function.

fn:error($error as xs:QName?, $description as xs:string)

Function signature

Result |

XPath 2.0 Specification

Raises an error.

If supplied, the error code (local part and namespace URI part) is recorded as part of the exception that's supplied to a user-defined JAXP `ErrorListener`, or that is returned to the calling application. The code is also available to the `catch` part of a call on the `saxon:try` extension function. The value of the `$description` is available by calling `getMessage()` on the `Exception` object.

fn:error($error as xs:QName?, $description as xs:string, $error-object as item()*)

Function signature

Result |

XPath 2.0 Specification

Raises an error.

If supplied, the error code (local part and namespace URI part) is recorded as part of the exception that's supplied to a user-defined JAXP `ErrorListener`, or that is returned to the calling application.

The code is also available to the `catch` part of a call on the `saxon:try` extension function. The value of the `$description` is available by calling `getMessage()` on the `Exception` object, and the object supplied in the third parameter is available from the `getErrorObject()` method. For use in the catch part of `saxon:try`, when re-throwing an error that has been caught, the error object may also be the `<error` element that was passed to the catch function.

Next