On 23/01/2012 20:42, Jaroslav Brazda wrote:

Hi

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

 

http://www.w3.org/TR/xquery-30/#id-try-catch

 

Saxon documentation indicates that it should support such constructs,

http://www.saxonica.com/documentation9.3/extensions/instructions/catch.xml

Actually, that page is describing a propietary XSLT extension saxon:try/saxon:catch, which predated the introduction of try/catch into XQuery 3.0 and XSLT 3.0.

The current state of support for XQuery try/catch in Saxon 9.3 is documented here:

http://www.saxonica.com/documentation9.3/using-xquery/xquery11support/trycatch.xml

and for Saxon 9.4 here:

http://www.saxonica.com/documentation/conformance/xquery30.xml

However, I think there is probably an omission here: It looks to me as if the implicitly declared variables such as $err:code are not yet implemented.

Michael Kay
Saxonica

 

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

 



------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help