From e18d59e54e3f39417f1f5b01f35867db34d5e1fe Mon Sep 17 00:00:00 2001 From: Jamiel Rahi Date: Sat, 18 Sep 2021 17:24:34 +0200 Subject: [PATCH] fix: handle error if getNextUrl throws --- reconnecting-websocket.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reconnecting-websocket.ts b/reconnecting-websocket.ts index ba7f4c47..fa463554 100644 --- a/reconnecting-websocket.ts +++ b/reconnecting-websocket.ts @@ -387,7 +387,11 @@ export default class ReconnectingWebSocket { this._addListeners(); this._connectTimeout = setTimeout(() => this._handleTimeout(), connectionTimeout); - }); + }) + .catch(err => { + this._connectLock = false; + this._handleError(new Events.ErrorEvent(Error(err.message), this)) + }) } private _handleTimeout() {