fn:error
Raises an error.
error($code as xs:QName?:=(), $description as xs:string?:=(), $value as item()*:=.) ➔ item()*
Arguments | ||||
| $code | xs:QName? | := () | The error code to be returned |
| $description | xs:string? | := () | An error message |
| $value | item()* | := . | An object or value associated with the error |
Result | item()* | |||
Namespace
http://www.w3.org/2005/xpath-functions
Links to W3C specifications
XPath 3.1 Functions and Operators
XPath 4.0 Functions and Operators
Saxon availability
Available in XPath 2.0, XSLT 2.0, XQuery 1.0, and later versions. Available in all Saxon editions. Available for all platforms.
Notes on the Saxon implementation
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 value
of the $description is available by calling getMessage() on the
Exception object. The error details are also available to the
catch part of a call when using the XQuery 3.0 or XSLT 3.0 try/catch
construct.