Thanks Geert. This is ideally what I'd like to do, but there doesn't seem to be 
a way to pass the context of the current exception back to error(). It is 
possible to get the error code, name, and description and then rethrow. In this 
case it will raise the error from the error handler context.

Then it's smart enough to print out "Old Error" followed by a pretty-printed 
xdmp:quote() of the $error:error variable. That's partially useful, but it's 
not clear to me how to wire it so that it rethrows using the context of 
$error:error. As it is, it would be very hard to read the error details through 
sea of XML.

For now, I have just been trying to reverse engineer current error handler, 
followed by my updates. 

-Will


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Geert Josten
Sent: Tuesday, October 30, 2012 1:58 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Extending error handling

Hi Will,

The default behavior is as far as I know indeed built-in. At least, never saw a 
module that seemed to implement the built-in behavior. But perhaps you don't 
need to reference it from XQuery. I think that any error raised in a custom 
error handler is caught by the built-in one. So, don't write output, but always 
raise a new error through fn:error. You might need to fiddle a bit to find a 
way to pass through exceptions 'untouched' if you would like to..

Kind regards,
Geert

> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:general- 
> [email protected]] Namens Will Thompson
> Verzonden: dinsdag 30 oktober 2012 18:20
> Aan: MarkLogic Developer Discussion
> Onderwerp: [MarkLogic Dev General] Extending error handling
>
> I want to extend the functionality of the existing HTTP error handler,
but not
> necessarily replace it. I thought at the very least I could make a 
> copy
of the
> existing error handler, add my extensions, and point the App Server
there, but I
> can't seem to find the right XQY module. Is the default error handler
part of the
> executable, not XQY?
>
> -Will
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to