Handle errors while opening a Websocket
For example, previously if the user typed in illegal characters in the port field, no error would be displayed in the interface and the page would stop at "connecting".
This commit is contained in:
parent
d24de750b1
commit
376864d6d1
|
@ -372,7 +372,15 @@
|
|||
uri += '://' + this._rfb_host + ':' + this._rfb_port + '/' + this._rfb_path;
|
||||
Util.Info("connecting to " + uri);
|
||||
|
||||
try {
|
||||
this._sock.open(uri, this._wsProtocols);
|
||||
} catch (e) {
|
||||
if (e.name === 'SyntaxError') {
|
||||
this._fail("Invalid host or port value given");
|
||||
} else {
|
||||
this._fail("Error while opening websocket (" + e + ")");
|
||||
}
|
||||
}
|
||||
|
||||
Util.Debug("<< RFB.connect");
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue