Skip to content

Commit

Permalink
fix(WebSocketShard): don't catch errors thrown in event handlers (#5803)
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceEEC committed Jun 11, 2021
1 parent f5f3f77 commit 53d8e49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client/websocket/WebSocketShard.js
Expand Up @@ -291,12 +291,12 @@ class WebSocketShard extends EventEmitter {
let packet;
try {
packet = WebSocket.unpack(raw);
this.manager.client.emit(Events.RAW, packet, this.id);
if (packet.op === OPCodes.DISPATCH) this.manager.emit(packet.t, packet.d, this.id);
} catch (err) {
this.manager.client.emit(Events.SHARD_ERROR, err, this.id);
return;
}
this.manager.client.emit(Events.RAW, packet, this.id);
if (packet.op === OPCodes.DISPATCH) this.manager.emit(packet.t, packet.d, this.id);
this.onPacket(packet);
}

Expand Down

0 comments on commit 53d8e49

Please sign in to comment.