Hi,
The current Application Developer’s Guide (labeled MarkLogic 5 -
October, 2011) says in §17.1.1 "Overview of Custom HTTP Error Pages":
When any 400 or 500 HTTP exception is thrown (except for a 503
error), an XQuery module is evaluated and the results are returned
to the client.
By "throwing any 400 or 500 HTTP exception", I thought it meant
"setting the HTTP response code, using xdmp:set-response-code(), to
any 400 or 500 error code". But it seems I'm wrong. I have the
following error handler, configured in the field "error handler" in my
HTTP app server:
xquery version "1.0-ml";
<error>HTTP error: { xdmp:get-response-code() }</error>
and a sample page returning a 404:
xquery version "1.0-ml";
xdmp:set-response-code(404, "Not found") ,
<page>Should NOT be returned.</page>
When I try to GET it through HTTP, it is actually returned. If
I change xdmp:set-response-code() to fn:error(), I get the expected
result: "<error>HTTP error: 500 Internal Server Error</error>".
Why the error handler is not kicked off in the first case? Did
I miss anything?
Regards,
--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general