[MarkLogic Dev General] fn:error and error code

Geert Josten geert.josten at dayon.nl
Tue Mar 6 10:33:26 PST 2012

Hi Steve,

Even worse. The built-in errors have a different layout:



  <error:message>Division by zero</error:message>

For those from fn:error the code and message element have same contents. To
my knowledge this has always been like this. Not sure why. I reccon it is a
bit late to change it now..

Kind regards,


*Van:* general-bounces at developer.marklogic.com [mailto:
general-bounces at developer.marklogic.com] *Namens *Steve Spigarelli
*Verzon**den:* dinsdag 6 maart 2012 19:25
*Aan:* general at developer.marklogic.com
*Onderwerp:* [MarkLogic Dev General] fn:error and error code

I've noticed that in the documentation for the fn:error function that the
first parameter can be an xs:QName for the error code. However, when I
xdmp:log the caught error I get the code in the name and the name in the
code field.

Here is the code that I'm running:

xquery version "1.0-ml";

module namespace test = "test-error";

declare function test-error() {

    try {

    fn:error(xs:QName("MY-ERROR"), "my test error", ())

    } catch ($e) {




and here is what I get in the resulting error xml:


<error:code>my test error</error:code>



Any idea why this works this way?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120306/0720e90c/attachment.html 

More information about the General mailing list