I tried to use try/catch expression as it is described in XQuery 3.0 specification




Saxon documentation indicates that it should support such constructs,



I’m getting following error when I try to run code listed below

Try/catch block itself works but I need to get access to error information to generate formated error message in my library module. How can I access error information inside catch block

Error on line 12 column 14 of expression-test.xq:

  XPST0008 XQuery static error near #...) } catch * { $err:code, $#:

    Variable $err:code has not been declared

Static error(s) in query



    Saxon try/catch support test


xquery version "3.0";


declare namespace err = 'http://www.w3.org/2005/xqt-errors';

try {

    fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000'))


catch * {

    $err:code, $err:value, " module: ", $err:module, "(", $err:line-number, ",", $err:column-number, ")"




Jaroslav Brazda

Senior Consulting Architect

Email: jaroslav.brazda@activevos.com

Cell: 617-335-6991