An exception that provides information on XQJ, XQuery or other errors reported by an XQJ implementation.
Each
XQException
provides several kinds of information:
- a string describing the error. This is used as the Java Exception message, available via the method
getMessage
. - the cause of the error. This is used as the Java Exception cause, available via the method
getCause
. - the vendor code identifying the error. Available via the method
getVendorCode
. Refer to the vendor documentation which specific codes can be returned. - a chain of
XQException
objects. If more than one error occurred the exceptions are referenced via this chain.
Note that
XQException
has a subclass {@link XQQueryException XQQueryException} providing more detailedinformation about errors that occurred during the processing of a query. An implementation throws a base
XQException
when an error occurs in the XQJ implementation. Further, implementations are encouraged to use the more detailed
XQQueryException
in case of an error reported by the XQuery engine.
It is possible that during the processing of a query that one or more errors could occur, each with their own potential causal relationship. This means that when an XQJ application catches an
XQException
, there is a possibility that there may be additional
XQException
objects chained to the original thrown
XQException
. To access the additional chained
XQException
objects, an application would recursively invoke
getNextException
until a
null
value is returned.
An
XQException
may have a causal relationship, which consists of one or more
Throwable
instances which caused the
XQException
to be thrown. The application may recursively call the method
getCause
, until a
null
value is returned, to navigate the chain of causes.