]> git.ipfire.org Git - thirdparty/httpx.git/commitdiff
Map `httpcore` transport close exceptions to `httpx` exceptions. (#1606)
authorTom Christie <tom@tomchristie.com>
Thu, 29 Apr 2021 11:37:37 +0000 (12:37 +0100)
committerGitHub <noreply@github.com>
Thu, 29 Apr 2021 11:37:37 +0000 (12:37 +0100)
httpx/_transports/default.py

index 39e410824d12fb886e6977a8248e5b8fe72ed6ab..1e58b5299480cbaad58a9f0394fec619eedac5e6 100644 (file)
@@ -162,7 +162,8 @@ class HTTPTransport(BaseTransport):
         exc_value: BaseException = None,
         traceback: TracebackType = None,
     ) -> None:
-        self._pool.__exit__(exc_type, exc_value, traceback)
+        with map_httpcore_exceptions():
+            self._pool.__exit__(exc_type, exc_value, traceback)
 
     def handle_request(
         self,
@@ -256,7 +257,8 @@ class AsyncHTTPTransport(AsyncBaseTransport):
         exc_value: BaseException = None,
         traceback: TracebackType = None,
     ) -> None:
-        await self._pool.__aexit__(exc_type, exc_value, traceback)
+        with map_httpcore_exceptions():
+            await self._pool.__aexit__(exc_type, exc_value, traceback)
 
     async def handle_async_request(
         self,