Skip to content

Commit

Permalink
[fix] Fix issue with errors during WebSocket creation not being caugh…
Browse files Browse the repository at this point in the history
…t at all (#475)

Fixes #474.
  • Loading branch information
Andarist authored and darrachequesne committed Oct 5, 2016
1 parent ea29487 commit f9274e1
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 f9274e1

Please sign in to comment.