Skip to content

Commit 74536ba

Browse files
authored
CHIA-1568: fix object has no attribute code errors (#18665)
* fix object has no attribute code errors * fix
1 parent b353a39 commit 74536ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chia/server/ws_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from dataclasses import dataclass, field
99
from typing import Any, Awaitable, Callable, Dict, List, Optional, Set, Tuple, Union
1010

11-
from aiohttp import ClientSession, WSCloseCode, WSMessage, WSMsgType
11+
from aiohttp import ClientSession, WebSocketError, WSCloseCode, WSMessage, WSMsgType
1212
from aiohttp.client import ClientWebSocketResponse
1313
from aiohttp.web import WebSocketResponse
1414
from packaging.version import Version
@@ -708,7 +708,7 @@ async def _read_one_message(self) -> Optional[Message]:
708708
return full_message_loaded
709709
elif message.type == WSMsgType.ERROR:
710710
self.log.error(f"WebSocket Error: {message}")
711-
if message.data.code == WSCloseCode.MESSAGE_TOO_BIG:
711+
if isinstance(message.data, WebSocketError) and message.data.code == WSCloseCode.MESSAGE_TOO_BIG:
712712
asyncio.create_task(self.close(300))
713713
else:
714714
asyncio.create_task(self.close())

0 commit comments

Comments
 (0)