Pass error+body when json requests fail parsing #762

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@johan

To safely use json requests, I need to be able to trust that error handling of unexpected non-json responses works. This passes back the JSON.parse error as a request failure, attatching the non-json to a data attribute of the error object.

Points to consider: should it substitute its own error message with a human-readable one mentioning the url, like a few of the others? Attach the url just as it now does the body? Fine as suggested?

@mikeal
request member

emitting an error here will throw if unhandled which is a breaking change :(

@mikeal mikeal closed this Aug 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment