Skip to content

Commit

Permalink
fix: Raise WebSocketClosure on protocol level errors (#2435)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jegarde authored Apr 26, 2024
1 parent c12670a commit 0536899
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions discord/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,13 +603,11 @@ async def poll_event(self):
await self.received_message(msg.data)
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
elif msg.type in (
aiohttp.WSMsgType.CLOSED,
aiohttp.WSMsgType.CLOSING,
aiohttp.WSMsgType.CLOSE,
aiohttp.WSMsgType.ERROR,
):
_log.debug("Received %s", msg)
raise WebSocketClosure
Expand Down

0 comments on commit 0536899

Please sign in to comment.