mirror of
https://github.com/unmojang/node-minecraft-protocol.git
synced 2025-09-27 13:14:41 -04:00
Emitting error objects instead of just strings. 😁
This commit is contained in:
parent
c4fbd81674
commit
7aef44bcb7
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user