Skip to content

Commit

Permalink
[PR #8049/a379e634 backport][3.9] Set cause for ClientPayloadError (#…
Browse files Browse the repository at this point in the history
…8050)

**This is a backport of PR #8049 as merged into master
(a379e63).**
  • Loading branch information
patchback[bot] authored Jan 21, 2024
1 parent 437ac47 commit a54dab3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions aiohttp/client_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def connection_lost(self, exc: Optional[BaseException]) -> None:
if self._parser is not None:
try:
uncompleted = self._parser.feed_eof()
except Exception:
except Exception as e:
if self._payload is not None:
self._payload.set_exception(
ClientPayloadError("Response payload is not completed")
)
exc = ClientPayloadError("Response payload is not completed")
exc.__cause__ = e
self._payload.set_exception(exc)

if not self.is_eof():
if isinstance(exc, OSError):
Expand Down

0 comments on commit a54dab3

Please sign in to comment.