Better error handling
Opened this issue · 3 comments
I am encountering an issue where Fullcontact returns a 503 (see https://www.fullcontact.com/developer/docs/#response-codes)
Now I need access to the headers of the response to be able to properly deal with this.
I suggest adding the headers to the error.
Adding additional info to the returned error seems like a good plain. I've been doing that for quite a while now for HTTP responses using: https://github.com/unshiftio/failure
Where I add things like statusCode, body and headers to the error object. It also automatically adds a toJSON
method to the errors so you can easily JSON stringify them for logging purposes.
seems good, you want me to do a pr with that?
@AdriVanHoudt yeah, a PR would be helpful as you know which props you need to debug these error codes.