Merge pull request #1092 from nickewansmith/fix-unhandled-rejection-warning-on-send

Fix Unhandled Promise Rejection Warning on message _send
This commit is contained in:
FKSRipple
2019-11-13 19:54:48 -08:00
committed by GitHub

View File

@@ -382,6 +382,7 @@ class Connection extends EventEmitter {
_whenReady<T>(promise: Promise<T>): Promise<T> {
return new Promise((resolve, reject) => {
promise.catch(reject);
if (!this._shouldBeConnected) {
reject(new NotConnectedError())
} else if (this._state === WebSocket.OPEN && this._isReady) {