-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 and use ClientConnectionResetError #9137
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #9137 +/- ##
==========================================
+ Coverage 98.30% 98.31% +0.01%
==========================================
Files 107 107
Lines 34433 34498 +65
Branches 4085 4096 +11
==========================================
+ Hits 33850 33918 +68
+ Misses 411 410 -1
+ Partials 172 170 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
If this is being reused on server and client sides, it's probably going to be confusing UX-wise. |
The thing is that I'm fairly confident this doesn't reach the user server-side. Any such exception is caught somewhere and handled. |
In that case, why would it need to derive from client exceptions? |
Because it propagates client-side and the user needs to catch it.. |
Ah, I think I parsed your previous message wrong ;) |
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.
This approach makes sense to me.
Would be good to add some coverage in these places that both exception types work
tests/test_base_protocol.py: with pytest.raises(ConnectionResetError):
tests/test_client_ws.py: with pytest.raises(ConnectionResetError):
tests/test_client_ws_functional.py: resp._conn.transport, "write", side_effect=ConnectionResetError
tests/test_http_writer.py: with pytest.raises(ConnectionResetError):
tests/test_http_writer.py: """Test that writing to a closed transport raises ConnectionResetError.
tests/test_http_writer.py: writing to the transport. If it is None, it raises ConnectionResetError.
tests/test_http_writer.py: with pytest.raises(ConnectionResetError, match="Cannot write to closing transport"):
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Backport to 3.10: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply f95bcaf on top of patchback/backports/3.10/f95bcaf4e0b2344d09df8dbb565150dcb4e73c0f/pr-9137 Backporting merged PR #9137 into master
🤖 @patchback |
Backport to 3.11: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply f95bcaf on top of patchback/backports/3.11/f95bcaf4e0b2344d09df8dbb565150dcb4e73c0f/pr-9137 Backporting merged PR #9137 into master
🤖 @patchback |
(cherry picked from commit f95bcaf)
(cherry picked from commit f95bcaf)
Not sure if we should do it like this, or we should catch the exception in the client code and reraise this exception in order to be sure that a client exception doesn't get raised in the web side. Reraising would require updating a fair few places though in client_ws.py and client_reqrep.py and may make the code less readable with all the extra try/excepts.
Fixes #8505.