Skip to content

Commit a54dab3

Browse files
[PR #8049/a379e634 backport][3.9] Set cause for ClientPayloadError (#8050)
**This is a backport of PR #8049 as merged into master (a379e63).**
1 parent 437ac47 commit a54dab3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: aiohttp/client_proto.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ def connection_lost(self, exc: Optional[BaseException]) -> None:
8181
if self._parser is not None:
8282
try:
8383
uncompleted = self._parser.feed_eof()
84-
except Exception:
84+
except Exception as e:
8585
if self._payload is not None:
86-
self._payload.set_exception(
87-
ClientPayloadError("Response payload is not completed")
88-
)
86+
exc = ClientPayloadError("Response payload is not completed")
87+
exc.__cause__ = e
88+
self._payload.set_exception(exc)
8989

9090
if not self.is_eof():
9191
if isinstance(exc, OSError):

0 commit comments

Comments
 (0)