Issue Summary
Currently, the data that you get from SendgridError.response is a stringified json. That means in order to inspect it you have to parse it with JSON.parse. Thats a pain in the ass to do. The same is true of the response body for successful calls. This leads to code like const response = JSON.parse(response.body) everywhere in order to actually use the result of API calls or const body = JSON.parse(err.response.body) in order to get the details from any errors.
I think it would make sense to parse this data in the library so that users of the library don't have to.
- sendgrid-nodejs Version: master
- Node.js Version: 4.1.2
Issue Summary
Currently, the data that you get from
SendgridError.responseis a stringified json. That means in order to inspect it you have to parse it withJSON.parse. Thats a pain in the ass to do. The same is true of the response body for successful calls. This leads to code likeconst response = JSON.parse(response.body)everywhere in order to actually use the result of API calls orconst body = JSON.parse(err.response.body)in order to get the details from any errors.I think it would make sense to parse this data in the library so that users of the library don't have to.