From c5e6286c41dab46e1189333eede734e3b1995dc4 Mon Sep 17 00:00:00 2001 From: Ken Link Date: Mon, 1 Jun 2026 15:24:25 -0500 Subject: [PATCH] Replace ClientConnectionResetError with ClientConnectionError ClientConnectionResetError doesn't exist in older aiohttp releases (it was added in aiohttp 3.10+), so use ClientConnectionError which is the parent class to avoid increasing dependencies. --- websocket.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/websocket.py b/websocket.py index ed55358..baf0475 100644 --- a/websocket.py +++ b/websocket.py @@ -249,7 +249,7 @@ class Websocket: while True: try: raw_message: aiohttp.WSMessage = await ws.receive(timeout=timeout) - except aiohttp.ClientConnectionResetError: + except aiohttp.ClientConnectionError: raise WebsocketClosed(received=False) ws_logger.debug(f"Websocket[{self._idx}] received: {raw_message}") if raw_message.type is WSMsgType.TEXT: @@ -328,7 +328,7 @@ class Websocket: message["nonce"] = create_nonce(CHARS_ASCII, 30) try: await ws.send_json(message, dumps=json_minify) - except aiohttp.ClientConnectionResetError: + except aiohttp.ClientConnectionError: raise WebsocketClosed(received=False) ws_logger.debug(f"Websocket[{self._idx}] sent: {message}")