[MarkLogic Dev General] Custom Error Handling for REST API call

Erik Hennum Erik.Hennum at marklogic.com
Wed Jul 8 05:53:14 PDT 2015


Hi, Danny:

There isn't a way to customize standard error handling.

That said, I'm surprised that you're seeing a long response.  When I try, the total content of the error response is:

{"errorResponse":{"statusCode":404, "status":"Not Found", "messageCode":"RESTAPI-NODOCUMENT", "message":"RESTAPI-NODOCUMENT: (err:FOER0000) Resource or document does not exist:  category: content message: /not/there.json"}}

And the total content of the error log at info level is:

Info: App-Services: Status 500: RESTAPI-NODOCUMENT: (err:FOER0000) Resource or document does not exist:  category: content message: /not/there.json

Do you see the large output in the response or the log?  If the latter, is it possible you have logging set to debug or more fine grained?


Erik Hennum

________________________________
From: general-bounces at developer.marklogic.com [general-bounces at developer.marklogic.com] on behalf of Danny Sinang [d.sinang at gmail.com]
Sent: Wednesday, July 08, 2015 5:06 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Custom Error Handling for REST API call

Hi Raja,

Are you suggesting I create a resource extension instead and use fn:errorr() as described on that page ? If so, then yes, I believe that would be one solution.

However, I'm curious to see if there's a way to do custom error handling for the standard GET/v1/documents call. The doc at https://docs.marklogic.com/8.0/REST/GET/v1/documents doesn't seem to mention any way to do so.

Regards,
Danny


On Wed, Jul 8, 2015 at 7:52 AM, <Rajamani.Marimuthu at cognizant.com<mailto:Rajamani.Marimuthu at cognizant.com>> wrote:
Hi Danny ,

Did u check the below mentioned section in the REST API [extensions] document .

https://docs.marklogic.com/guide/rest-dev/extensions#id_33892


thanks and regards
Raja >>>

From: general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com> [mailto:general-bounces at developer.marklogic.com<mailto:general-bounces at developer.marklogic.com>] On Behalf Of Danny Sinang
Sent: Wednesday, July 08, 2015 4:26 PM
To: general
Subject: [MarkLogic Dev General] Custom Error Handling for REST API call

Is there a way to make the ML REST API on ML 8 do custom error handling ?

Right now, when we issue a request like this (for a non-existent document) :

GET /v1/documents/?uri=/1211/20/14/IC12112014.xml

We get a long (15 to 20-line) error message that starts off like this :


RESTAPI-NODOCUMENT: (err:FOER0000) Resource or document does not exist:  category: content message: /1211/20/14/IC12112014.xml

     ...



I'm hoping I could just replace the error message with a custom one-liner.



Regards,

Danny





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.

_______________________________________________
General mailing list
General at developer.marklogic.com<mailto:General at developer.marklogic.com>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20150708/102b0f8a/attachment.html 


More information about the General mailing list