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.
This commit is contained in:
1 parent
b5e199301e
commit
c5e6286c41
1 file changed
+2
-2
+2
-2
@@ -249,7 +249,7 @@ class Websocket:
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
raw_message: aiohttp.WSMessage = await ws.receive(timeout=timeout)
|
raw_message: aiohttp.WSMessage = await ws.receive(timeout=timeout)
|
||||||
except aiohttp.ClientConnectionResetError:
|
except aiohttp.ClientConnectionError:
|
||||||
raise WebsocketClosed(received=False)
|
raise WebsocketClosed(received=False)
|
||||||
ws_logger.debug(f"Websocket[{self._idx}] received: {raw_message}")
|
ws_logger.debug(f"Websocket[{self._idx}] received: {raw_message}")
|
||||||
if raw_message.type is WSMsgType.TEXT:
|
if raw_message.type is WSMsgType.TEXT:
|
||||||
@@ -328,7 +328,7 @@ class Websocket:
|
|||||||
message["nonce"] = create_nonce(CHARS_ASCII, 30)
|
message["nonce"] = create_nonce(CHARS_ASCII, 30)
|
||||||
try:
|
try:
|
||||||
await ws.send_json(message, dumps=json_minify)
|
await ws.send_json(message, dumps=json_minify)
|
||||||
except aiohttp.ClientConnectionResetError:
|
except aiohttp.ClientConnectionError:
|
||||||
raise WebsocketClosed(received=False)
|
raise WebsocketClosed(received=False)
|
||||||
ws_logger.debug(f"Websocket[{self._idx}] sent: {message}")
|
ws_logger.debug(f"Websocket[{self._idx}] sent: {message}")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user