==XQuery Errors==
XQuery runtime errors can be processed via ''error annotations''. One function can only have one error annotation, and a single argument must be supplied, which represents the error codes to be caught. Since {{Version|7.9}}, the following supported notations are supportedhave been aligned with the [[XQuery 3.0#Try.2FCatch|try/catch]] construct of XQuery 3.0:
{| class="wikitable"
Codes with a higher priority will be preferred. An error will be raised if two functions with conflicting codes and the same priority are supplied.
Similar to the [[XQuery 3.0#Try.2FCatch|try/catch]] construct, the pre-defined variables ({{Code|code}}, {{Code|description}}, {{Code|value}}, {{Code|module}}, {{Code|line-number}}, {{Code|column-number}}, {{Code|additional}}) can be bound to variables via ''error parameter annotations'', which are specified the same way as [[#Query Parameters|query parameters]].
Errors may occur unexpectedly. However, they can also be triggered by a query, as demonstrated by the following example: