diff --git a/lib/utils/ws-requestor.js b/lib/utils/ws-requestor.js index 16835f25..9946f6f7 100644 --- a/lib/utils/ws-requestor.js +++ b/lib/utils/ws-requestor.js @@ -69,7 +69,7 @@ class WsRequestor extends BaseRequestor { this.connectInProgress = true; this.logger.debug(`WsRequestor:request(${this.id}) - connecting since we do not have a connection`); if (this.connections >= MAX_RECONNECTS) { - throw new Error(`max attempts connecting to ${this.url}`); + return Promise.reject(`max attempts connecting to ${this.url}`); } try { const startAt = process.hrtime(); @@ -79,7 +79,7 @@ class WsRequestor extends BaseRequestor { } catch (err) { this.logger.info({url, err}, 'WsRequestor:request - failed connecting'); this.connectInProgress = false; - throw err; + return Promise.reject(err); } } assert(this.ws);