-
Notifications
You must be signed in to change notification settings - Fork 24
Improve error handling #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think it would be nice if we retry 429 errors by default... definitely a footgun that we do not. |
Typically, I'd leave that up to the consumer. Otherwise, it makes it harder to compose into If that feature was implemented, I would definitely want a way to configure it (number of retries, expo backoff, alternate server, etc) and would default it to off. IMO, there are too many good libraries out there that support this already, this one should only be concerned with exposing the information needed to hook into those (raw request/response info) |
Being configurable makes sense to me. My thinking is that having it on by default is a good, and users with more advanced usecases can just disable it and handle it themselves. |
Right now the error handling only exposes the response body via the standard
Error
class.statusCode
I'd probably copy axios and do something like this:
Or maybe even just have properties for
status
,body
, etc if it's already been parsed/consumed.Then you can do something like this in your catch blocks:
The text was updated successfully, but these errors were encountered: