Open benpate opened 9 years ago
In addition, I think we should bubble up some common HTTP errors into the err
return value. For instance, if we get an HTTP 500 error from the server, then err
should not come back null.
Hey @benpate -- yeah this is a great idea.
I've never run into this use case myself, as all of the API's I deal with have the same JSON schema for the error / non error state (usually there's an object for an error, and it's just set to null on success).
But, this is definitely not always the case.
I'm going to try to chunk out some time tonight + tackle this!
Great. This will be a huge addition -- especially for APIs that use HTTP status codes to report errors, like most of the ones I'm working to integrate. Right now, I'm basically getting a successful response and then empty data. It's sooo frustrating to troubleshoot X(
When we get a REST error from a remote server, it often includes a JSON package containing a description of the error, which is usually a very different JSON schema than a successful transaction. In this case, it would be nice to be able to unmarshal that information into another variable that is looking for those error values.
Because of wreckers chaining API, this seems like it would be a really great progressive enhancement:
What do you think?