mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 13:02:38 +00:00
ready event will now throw errors properly (#1440)
This commit is contained in:
parent
892ba67d71
commit
166161d6d3
2 changed files with 4 additions and 9 deletions
|
|
@ -273,12 +273,11 @@ class WebSocketConnection extends EventEmitter {
|
|||
*/
|
||||
onMessage(event) {
|
||||
try {
|
||||
this.onPacket(this.unpack(event.data));
|
||||
return true;
|
||||
event.data = this.unpack(event.data);
|
||||
} catch (err) {
|
||||
this.debug(err);
|
||||
return false;
|
||||
this.emit('debug', err);
|
||||
}
|
||||
return this.onPacket(event.data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -99,11 +99,7 @@ class WebSocketPacketManager {
|
|||
}
|
||||
|
||||
if (!queue && this.queue.length > 0) this.handleQueue();
|
||||
try {
|
||||
if (this.handlers[packet.t]) return this.handlers[packet.t].handle(packet);
|
||||
} catch (error) {
|
||||
this.client.emit(Constants.Events.ERROR, error);
|
||||
}
|
||||
if (this.handlers[packet.t]) return this.handlers[packet.t].handle(packet);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue