Replies: 2 comments 1 reply
-
I think a ClientConnectionResetError is a TCP-level error (i.e. the TCP connection got reset). The errors you referred to in the documentation are HTTP-level errors (i.e. the TCP connection behaved correctly, but the peer sent an invalid HTTP message or similar). The exceptions that inherit from builtin exceptions should behave much the same as the builtins (and in many cases are just wrappers around the builtin exception that was caught from cpython code). e.g. For ClientConnectionResetError, you can refer to https://docs.python.org/3/library/exceptions.html#ConnectionResetError |
Beta Was this translation helpful? Give feedback.
-
If you have specific suggestions to improve the docs, then it would be great if you could put them into a PR. Otherwise, I think this is just a discussion. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
The current documentation for the
ClientResponse.read()
method says:And the documentation for the related
ClientResponse.content
attribute notes that:Both of those seem surprising: given the exception hierarchy documented later on the page, I would expect a read error caused by a connection reset to instead raise a
ClientConnectionResetError
, but at the moment the rest of theClientResponse
documentation doesn't seem to mention it one way or another, and I'm having a hard time following the implementation clearly enough to figure out what is actually raised if the connection is reset in the middle of a response body.FWIW the only place where I see
read()
explicitly raising an exception, it's aClientConnectionError
, not aClientResponseError
:aiohttp/aiohttp/client_reqrep.py
Line 1163 in 3f07b1a
Either way, I would appreciate clearer documentation on the relationship between the various ways to read a
ClientResponse
body and the various subclasses ofClientConnectionError
.To Reproduce
Expected behavior
Clear, concise documentation of the behavior of
ClientResponse.read()
andClientResponse.content
in case of an unexpected connection reset.Code of Conduct
Beta Was this translation helpful? Give feedback.
All reactions