Handle immediate connection errors
The browser might throw an exception right away if there is something it doesn't like with our connect attempt. E.g. using a non-TLS WebSocket from a TLS web page.
This commit is contained in:
parent
7d2dad0f9e
commit
9ac632deee
16
app/ui.js
16
app/ui.js
|
@ -1041,10 +1041,18 @@ const UI = {
|
||||||
}
|
}
|
||||||
url += '/' + path;
|
url += '/' + path;
|
||||||
|
|
||||||
UI.rfb = new RFB(document.getElementById('noVNC_container'), url,
|
try {
|
||||||
{ shared: UI.getSetting('shared'),
|
UI.rfb = new RFB(document.getElementById('noVNC_container'), url,
|
||||||
repeaterID: UI.getSetting('repeaterID'),
|
{ shared: UI.getSetting('shared'),
|
||||||
credentials: { password: password } });
|
repeaterID: UI.getSetting('repeaterID'),
|
||||||
|
credentials: { password: password } });
|
||||||
|
} catch (exc) {
|
||||||
|
Log.Error("Failed to connect to server: " + exc);
|
||||||
|
UI.updateVisualState('disconnected');
|
||||||
|
UI.showStatus(_("Failed to connect to server: ") + exc, 'error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UI.rfb.addEventListener("connect", UI.connectFinished);
|
UI.rfb.addEventListener("connect", UI.connectFinished);
|
||||||
UI.rfb.addEventListener("disconnect", UI.disconnectFinished);
|
UI.rfb.addEventListener("disconnect", UI.disconnectFinished);
|
||||||
UI.rfb.addEventListener("serververification", UI.serverVerify);
|
UI.rfb.addEventListener("serververification", UI.serverVerify);
|
||||||
|
|
Loading…
Reference in New Issue