From 8305f8f0f941369799a17a6662fbccda71da1d66 Mon Sep 17 00:00:00 2001 From: Illia Volochii <illia.volochii@gmail.com> Date: Fri, 26 Feb 2021 23:09:20 +0200 Subject: [PATCH] Use `client_error` instead of a hard-coded exception in `TCPConnector` `client_error` is an existing method argument. And it seems that it is supposed to be used in the two places instead of the hard-coded exception. --- CHANGES/5502.bugfix | 2 ++ aiohttp/connector.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 CHANGES/5502.bugfix diff --git a/CHANGES/5502.bugfix b/CHANGES/5502.bugfix new file mode 100644 index 00000000000..32d256b5357 --- /dev/null +++ b/CHANGES/5502.bugfix @@ -0,0 +1,2 @@ +Use variable ``client_error`` instead of a hard-coded ``ClientConnectorError`` exception +in ``TCPConnector``. diff --git a/aiohttp/connector.py b/aiohttp/connector.py index 58c528de6fb..0445bf36959 100644 --- a/aiohttp/connector.py +++ b/aiohttp/connector.py @@ -985,7 +985,7 @@ def drop_exception(fut: "asyncio.Future[List[Dict[str, Any]]]") -> None: except OSError as exc: # in case of proxy it is not ClientProxyConnectionError # it is problem of resolving proxy ip itself - raise ClientConnectorError(req.connection_key, exc) from exc + raise client_error(req.connection_key, exc) from exc last_exc = None # type: Optional[Exception] @@ -1008,7 +1008,7 @@ def drop_exception(fut: "asyncio.Future[List[Dict[str, Any]]]") -> None: req=req, client_error=client_error, ) - except ClientConnectorError as exc: + except client_error as exc: last_exc = exc continue