From 163a86c4a031f7ecd856f45a74da47e63b17bb16 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 19 Oct 2023 01:16:48 -0400 Subject: [PATCH] Raise WebSocketClosure on protocol level errors Ref: #9561 --- discord/gateway.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/gateway.py b/discord/gateway.py index 4f98bc2c1bbb..dc52828134a9 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -624,8 +624,8 @@ async def poll_event(self) -> None: elif msg.type is aiohttp.WSMsgType.BINARY: await self.received_message(msg.data) elif msg.type is aiohttp.WSMsgType.ERROR: - _log.debug('Received %s', msg) - raise msg.data + _log.debug('Received error %s', msg) + raise WebSocketClosure elif msg.type in (aiohttp.WSMsgType.CLOSED, aiohttp.WSMsgType.CLOSING, aiohttp.WSMsgType.CLOSE): _log.debug('Received %s', msg) raise WebSocketClosure