Hi Steve,


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



  <error:code>XDMP-DIVBYZERO</error:code>

  <error:name>err:FOAR0001</error:name>

  <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,

Geert



*Van:* [email protected] [mailto:
[email protected]] *Namens *Steve Spigarelli
*Verzon**den:* dinsdag 6 maart 2012 19:25
*Aan:* [email protected]
*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) {

        xdmp:log($e)

    }

};



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



...

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

  <error:name>MY-ERROR</error:name>

...





Any idea why this works this way?
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to