From c4fbd8167447fe903bd4401ed4ef548ade093592 Mon Sep 17 00:00:00 2001 From: Ethan Davis Date: Tue, 16 Jan 2018 18:24:48 -0800 Subject: [PATCH] Replaced throw for "Set encryption twice!" error with emit. --- src/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.js b/src/client.js index 4e51912..05ae4c9 100644 --- a/src/client.js +++ b/src/client.js @@ -194,7 +194,7 @@ class Client extends EventEmitter setEncryption(sharedSecret) { if (this.cipher != null) - throw new Error("Set encryption twice !"); + this.emit('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);