Error Functions

Error functions raise custom errors and log diagnostic values during evaluation.
error(fn:QName('http://www.example.com/HR', 'myerr:toohighsal'))Raises an error, identified by the given QName, which can be caught by a try/catch construct in XQuery or XSLT.
trace($v, 'the value of $v is:')Logs the value of $v together with the given label for diagnostic purposes, then returns $v unchanged.

ch03-error-functions.xpath.txt:
error(fn:QName('http://www.example.com/HR', 'myerr:toohighsal'))
trace($v, 'the value of $v is:')