[MarkLogic Dev General] fn:error

Abhinav.Mishra3 at cognizant.com Abhinav.Mishra3 at cognizant.com
Tue Mar 31 05:09:09 PDT 2015


Do some brain storming, look into existing error handler which OOB Marklogic provides (as mentioned by Asit).
You will get the sample code there.

From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Asitmohan Nautiyal
Sent: Tuesday, March 31, 2015 4:49 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] fn:error

Hi Pragya,

There several ways that you can achieve this task. You can create you own error-handler.xqy file with your custom message and codes same as MarkLogic default error handler(see into installation directory).
Then enter the error handler name with path(i.e /error-handler.xqy) in the error handler   field of your corresponding MarkLogic http server. Give the all permissions needed to execute this file.  This is a generic way to handle the errors for all your XQuery modules.


Regards,
Asit Nautiyal

________________________________
From: general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com> [general-bounces at developer.marklogic.com] on behalf of Kapoor, Pragya [PKapoor1 at innodata.com]
Sent: Tuesday, March 31, 2015 11:21 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] fn:error

​Hi Asit,



Could you give some sample of codes for the same.



Thanks

Pragya

________________________________
From: general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com> <general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com>> on behalf of Asitmohan Nautiyal <asitmohan.n at hcl.com<mailto:asitmohan.n at hcl.com>>
Sent: Monday, March 30, 2015 5:45 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] fn:error

Hi Pragya,

500 response code is coming from MarkLogic predefined error utility file where all response code has been defined as per specific message or standards. You need to change that configuration file manually but its not recommended at all.

You can create your own custom xml file with your custom codes and messages. While throwing the respective error you can return your own customize response.


Regards,
Asit Nautiyal
________________________________
From: general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com> [general-bounces at developer.marklogic.com] on behalf of Kapoor, Pragya [PKapoor1 at innodata.com]
Sent: Monday, March 30, 2015 4:54 PM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] fn:error

Hi,



I am using fn:error as :


if($e//error:code/text() eq "XDMP-LEXVAL") then
    fn:error(xs:QName("ERROR"), "Incorrect Data Entered in Search Query")
else ()

I get a response as :

<error-info>
    <code>500</code>
    <error-type>server</error-type>
    <message>Internal Server Error | ERROR - Incorrect Data Entered in Search Query</message>
    <description>Incorrect Data Entered in Search Query (ERROR): in /rest-apis/search/search-document.xqy at line number 616</description>
</error-info>​

In my response error code is 500. I need to change the code to some other no say 510.
How can I achieve this?

Thanks
Pragya
​




"This e-mail and any attachments transmitted with it are for the sole use of the intended recipient(s) and may contain confidential , proprietary or privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this e-mail or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful."


::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.
----------------------------------------------------------------------------------------------------------------------------------------------------
"This e-mail and any attachments transmitted with it are for the sole use of the intended recipient(s) and may contain confidential , proprietary or privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this e-mail or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful."
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20150331/0d97a4bb/attachment-0001.html 


More information about the General mailing list