-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Raise the real error if max retries failed. #4389
Comments
Which error is the real one? What happens if for each of your three retries, we get a different error? Let's say, first we get a |
Thats a good question @sigmavirus24 Basically I wish to know to real error from the API I tried to call so it'll be easier to debug using tools like Sentry. Currently it logges under MaxRetries error which forces me to try and reconstruct, and thats not always possible. |
I think you may want a different way of retrying errors then. In fact, I think you may want to have a separate abstraction such that you can attempt a request, send the error to sentry, and then repeat up until you hit your limit. That would give you the "real error" on each attempt. Right now, the exception we're raising really makes the most sense (MaxRetries) because we've reached our Retry limit (specified by you) and there's nothing more for us to do. Browsers have similar behaviour. If a website redirects too many times or fails to load too many times, Browsers will tell you as much. |
Right, so I'm closing this now. I don't think that Requests or urllib3 should try to keep track of each error that led to a retry. If we did that, we could start leaking resources or even other sensitive information that users may not want stored. Perhaps, urllib3 would want to consider allowing the user to specify some kind of callback for each retry (which a user could then pass a logger to or some other function that posts to an error handling service) but that belongs there, not here :) |
When using Retry(), if max retries is reached an error is thrown "max retries".
Is it possible to see the real API error? the real HTTP response instead?
Expected Result
The real error/http response. (ResponseError in the example below)
Actual Result
max retries error, not logging correctly on Sentry.
Reproduction Steps
System Information
The text was updated successfully, but these errors were encountered: