From 6033676f6b985a433a3a25b1f560eeb9a9b78dc5 Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Wed, 23 Feb 2022 14:02:26 -0500 Subject: [PATCH] bugfix: uncaught exception when ws fails or times out handshake --- lib/utils/ws-requestor.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/utils/ws-requestor.js b/lib/utils/ws-requestor.js index b6883fcb..86884aea 100644 --- a/lib/utils/ws-requestor.js +++ b/lib/utils/ws-requestor.js @@ -109,8 +109,10 @@ class WsRequestor extends BaseRequestor { close() { this.logger.info('WsRequestor: closing socket'); - this.ws && this.ws.close(); - this.ws.removeAllListeners(); + if (this.ws) { + this.ws.close(); + this.ws.removeAllListeners(); + } } _connect() {