Skip to content

Commit

Permalink
Fixed issue with errors during WebSocket creation not being caught at…
Browse files Browse the repository at this point in the history
… all (fixes #474)
  • Loading branch information
Andarist committed May 26, 2016
1 parent 2e25662 commit 56541fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/transports/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ WS.prototype.doOpen = function () {
opts.headers = this.extraHeaders;
}

this.ws = BrowserWebSocket ? new WebSocket(uri) : new WebSocket(uri, protocols, opts);
try {
this.ws = BrowserWebSocket ? new WebSocket(uri) : new WebSocket(uri, protocols, opts);
} catch (err) {
return this.emit('error', err)
}

if (this.ws.binaryType === undefined) {
this.supportsBinary = false;
Expand Down

0 comments on commit 56541fb

Please sign in to comment.