-
Notifications
You must be signed in to change notification settings - Fork 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
Add a generic network exception to be raised #8133
Conversation
I want to get reviews on the approach. |
I am really not sure, where I should put the test? Any hint? |
You mean you want to test the network errors are raised and caught correctly? I don’t really think it’s viable TBH. You can probably unit-test the raising part by mocking out some requests internals, but that’s quite complex for a pretty modest return. |
Yeah, was thinking about that. So, is there something else missing in this PR? |
74c2143
to
9035702
Compare
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
9035702
to
e6d0301
Compare
Hello! I am an automated bot and I have noticed that this pull request is not currently able to be merged. If you are able to either merge the |
e6d0301
to
cf4a84a
Compare
@@ -95,3 +96,8 @@ def response_chunks(response, chunk_size=CONTENT_CHUNK_SIZE): | |||
if not chunk: | |||
break | |||
yield chunk | |||
except (NewConnectionError, ReadTimeoutError) as exc: | |||
raise NetworkConnectionError( | |||
"Failed to get address for host! Check your network connectivity " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failed to get address for host!
seems weird for a ReadTimeoutError
It definitely makes sense for NewConnectionError
in the context of #5380 (comment) but I don't think we should conflate the two exceptions types.
@ichard26 With your ongoing work around the retrying logic, I wanted to flag this to you -- either to incorporate or close this out given that this is significantly out of date now. |
Ha, this is an old pull request :) Catching Anyhow, this PR isn't necessary. Thanks for bringing this to my attention! Footnotes
|
Towards #5380
The other PR may be created for removing the usage of
raise_for_status
.