Skip to content

Commit

Permalink
Fix lost details on HttpProcessingError (#9052) (#9205)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8911419)
  • Loading branch information
Dreamsorcerer committed Sep 20, 2024
1 parent e9609ad commit 2508fac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/9052.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed exception information getting lost on ``HttpProcessingError`` -- by :user:`Dreamsorcerer`.
10 changes: 9 additions & 1 deletion aiohttp/client_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,15 @@ def data_received(self, data: bytes) -> None:
# closed in this case
self.transport.close()
# should_close is True after the call
self.set_exception(HttpProcessingError(), underlying_exc)
if isinstance(underlying_exc, HttpProcessingError):
exc = HttpProcessingError(
code=underlying_exc.code,
message=underlying_exc.message,
headers=underlying_exc.headers,
)
else:
exc = HttpProcessingError()
self.set_exception(exc, underlying_exc)
return

self._upgraded = upgraded
Expand Down

0 comments on commit 2508fac

Please sign in to comment.