RE: Re: catching parse exception using converter service
Thanks Thierry! I solved it by not throwing an exception for now when the parser fails. But I think it could be nice to be able to catch that exception in the statusService. Keep up the great work! -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/catching-parse-exception-using-converter-service-tp6024668p6029016.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2704626
catching parse exception using converter service
Hi! I'm using Restlet 2.0.4 with a converterService (Jackson). Problem is when I receive a Json object with a parse exception, it is not caught in the StatusService (which already works with any other exception that occurs within the resource) Example: WARNING: Unable to parse the object with Jackson. org.codehaus.jackson.map.JsonMappingException: Unrecognized field asd (Class com.example.ClassDTO), not marked as ignorable at [Source: org.restlet.engine.http.io.UnclosableInputStream@15e33df; line: 1, column: 2] I'd like to catch it in the StatusService to set the response with an error message. Thanks! -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/catching-parse-exception-using-converter-service-tp6024668p6024668.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2703993
Re: catching parse exception using converter service
I'm getting also as a response of the request a 415 http code UnsupportedMediaType which is not true since the Type is correct -- View this message in context: http://restlet-discuss.1400322.n2.nabble.com/catching-parse-exception-using-converter-service-tp6024668p6024796.html Sent from the Restlet Discuss mailing list archive at Nabble.com. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2703995
RE: Re: catching parse exception using converter service
Hello, I think that, for the moment, these kind of parsing errors are actually caught as unsupported media type error. Perhaps, this kind of exception should not be wrapped and hidden. I've entered an issue for that: http://restlet.tigris.org/issues/show_bug.cgi?id=1238 Best regards, Thierry Boileau -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2704007