Patch #24323
openImprove exceptions handling
Description
Hello,
I would like to improve REST api. Now you can use this request and specify requested format directly in the url like this:
but I expect this should work aswell
but the server responds with text (plain) 500 internal error - no builder for format
http://api.jquery.com/jQuery.ajax/
dataType (default: Intelligent Guess (xml, json, script, or html))
Type: String
The type of data that you're expecting back from the server.
before
status: 500
body: -
format: plain
patched
status: 422
body: {"errors":[{"error": "Something is wrong"}]}
format: json
I have also improved the render_error method, now you'll get a proper error message according to the format you're asking for. For instance an api request (post /something.json):
before:
status: 422
body: -
patched:
status: 422
body: {"errors":[{"error": "Something is wrong"}]}
Files
No data to display