[MarkLogic Dev General] Exit query without writing to error log?
David.Ennis at marklogic.com
Wed Jan 24 04:57:40 PST 2018
Further to Florent’s comment, assuming your code is OK with the error bubbling up to the top, you can catch them all in a single place and act accordingly using a custom error handler. Using this in conjunction with throwing your own errors (and handling the code in the top-level handler) can be useful.
From: <general-bounces at developer.marklogic.com> on behalf of Florent Georges <lists at fgeorges.org>
Reply-To: MarkLogic Developer Discussion <general at developer.marklogic.com>
Date: Wednesday, January 24, 2018 at 1:53 PM
To: MarkLogic Developer Discussion <general at developer.marklogic.com>
Subject: Re: [MarkLogic Dev General] Exit query without writing to error log?
The error is logged only if it "reaches the top", that is, if it is not caught.
If the error shouldn't behave as such, can't you just catch it before? (and yes, potentially return wathever HTTP response you deem appropriate).
On 24 January 2018 at 03:22, Evan Lenz wrote:
My client has XQuery parameter-validation code which calls the error() function when invalid parameters are supplied. This event gets written to the error log. Is there a way to prevent this?
I recognize the best practice is to return a more appropriate HTTP response code (than 500) when handling invalid input. I also recognize this is anathema to FP. But my question still stands:
Is there a way to interrupt/exit a query without triggering an Error-level log message?
President, Lenz Consulting Group, Inc.
General mailing list
General at developer.marklogic.com<mailto:General at developer.marklogic.com>
Manage your subscription at:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the General