mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
ready event will now throw errors properly (#1440)
This commit is contained in:
@@ -273,12 +273,11 @@ class WebSocketConnection extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
onMessage(event) {
|
onMessage(event) {
|
||||||
try {
|
try {
|
||||||
this.onPacket(this.unpack(event.data));
|
event.data = this.unpack(event.data);
|
||||||
return true;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.debug(err);
|
this.emit('debug', err);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return this.onPacket(event.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -99,11 +99,7 @@ class WebSocketPacketManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!queue && this.queue.length > 0) this.handleQueue();
|
if (!queue && this.queue.length > 0) this.handleQueue();
|
||||||
try {
|
if (this.handlers[packet.t]) return this.handlers[packet.t].handle(packet);
|
||||||
if (this.handlers[packet.t]) return this.handlers[packet.t].handle(packet);
|
|
||||||
} catch (error) {
|
|
||||||
this.client.emit(Constants.Events.ERROR, error);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user