krasserm / grails-jaxrs

JAX-RS Plugin for Grails
http://code.google.com/p/grails-jaxrs/
Apache License 2.0
50 stars 48 forks source link

Improved exception handling in JSONReader and XMLReader #25

Closed trpedersen closed 8 years ago

trpedersen commented 11 years ago

Hi,

Thanks for the good work with this plugin - it is working well for us.

An improvement though - if a client programs sends through invalid JSON or XML then the JSONReader and XMLReader code falls over with an uncaught exception (e.g. JsonException) causing an HTTP 500 error back at the client. IMHO this should be instead caught and send back to the client as a BAD_REQUEST (or similar) message, rather than a server error.

The two ..readFrom methods should catch any exceptions raised during xml or json parsing and wrap them in a WebApplicationException with the appropriate Response+status+entity+type set.

I've worked around it by using ExceptionMappers for now..

Tim Pedersen

noamt commented 11 years ago

Thanks for the feedback; I'll take a look at better handling for these cases

budjb commented 8 years ago

This issue was moved to budjb/grails-jaxrs#3