From 7aef44bcb7da0c8923be7619325ed23d26142e57 Mon Sep 17 00:00:00 2001 From: Ethan Davis Date: Wed, 17 Jan 2018 20:22:45 -0800 Subject: [PATCH] Emitting error objects instead of just strings. :grin: --- src/client.js | 2 +- src/client/autoVersion.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.js b/src/client.js index 05ae4c9..5f44cd1 100644 --- a/src/client.js +++ b/src/client.js @@ -194,7 +194,7 @@ class Client extends EventEmitter setEncryption(sharedSecret) { if (this.cipher != null) - this.emit('error','Set encryption twice!'); + this.emit('error', new Error('Set encryption twice!')); this.cipher = crypto.createCipheriv('aes-128-cfb8', sharedSecret, sharedSecret); this.cipher.on('error', (err) => this.emit('error', err)); this.framer.unpipe(this.socket); diff --git a/src/client/autoVersion.js b/src/client/autoVersion.js index f461eb0..8d61a19 100644 --- a/src/client/autoVersion.js +++ b/src/client/autoVersion.js @@ -30,7 +30,7 @@ module.exports = function(client, options) { .sort(function (a, b) { return b.version - a.version }) .concat(minecraft_data.postNettyVersionsByProtocolVersion["pc"][protocolVersion]||[]) if (versions.length === 0) { - client.emit('error',`unsupported/unknown protocol version: ${protocolVersion}, update minecraft-data`); + client.emit('error', new Error(`unsupported/unknown protocol version: ${protocolVersion}, update minecraft-data`)); } const minecraftVersion = versions[0].minecraftVersion;