Error doesn't let you capture any response data
jtyler258 opened this issue · comments
In our API we like to return information about errors especially 400 bad requests. For example:
{ "email": [ "Missing data for required field." ] }
However, the error thrown seems to only contain the status code:
Error: Request failed with status code 400
Burying the response data on error makes it more tedious to troubleshoot errors during implementation. Could a second parameter be added to the error callback that contains the response?
We ran into this issue as well. The response body needs to be easily accessible at a higher level in the error object. @jtyler258 were you able to find this somewhere in the error obj at all?
@jtyler258 aha. You'll want to look at err.response.data
to get the response body.