Skip to content

Commit 589c5a0

Browse files
Map httpcore transport close exceptions to httpx exceptions. (#1606)
1 parent 81f385c commit 589c5a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

httpx/_transports/default.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ def __exit__(
162162
exc_value: BaseException = None,
163163
traceback: TracebackType = None,
164164
) -> None:
165-
self._pool.__exit__(exc_type, exc_value, traceback)
165+
with map_httpcore_exceptions():
166+
self._pool.__exit__(exc_type, exc_value, traceback)
166167

167168
def handle_request(
168169
self,
@@ -256,7 +257,8 @@ async def __aexit__(
256257
exc_value: BaseException = None,
257258
traceback: TracebackType = None,
258259
) -> None:
259-
await self._pool.__aexit__(exc_type, exc_value, traceback)
260+
with map_httpcore_exceptions():
261+
await self._pool.__aexit__(exc_type, exc_value, traceback)
260262

261263
async def handle_async_request(
262264
self,

0 commit comments

Comments
 (0)