ready event will now throw errors properly (#1440)

This commit is contained in:
Drahcirius
2017-05-01 03:43:35 -04:00
committed by Amish Shah
parent 892ba67d71
commit 166161d6d3
2 changed files with 4 additions and 9 deletions

View File

@@ -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);
}
/**