Make error more specific at connection failure

The UI does after all have enough information to determine if the
disconnection event was received before or after we were connected. If
we were never connected at all, we should adapt the error message to
reflect this.
This commit is contained in:
Samuel Mannehed 2017-12-12 16:14:43 +01:00
parent edb3ea4f88
commit 7f1049c0ee
1 changed files with 8 additions and 2 deletions

View File

@ -1099,6 +1099,8 @@ var UI = {
},
disconnectFinished: function (e) {
let wasConnected = UI.connected;
// This variable is ideally set when disconnection starts, but
// when the disconnection isn't clean or if it is initiated by
// the server, we need to do it here as well since
@ -1107,8 +1109,12 @@ var UI = {
if (!e.detail.clean) {
UI.updateVisualState('disconnected');
if (wasConnected) {
UI.showStatus(_("Something went wrong, connection is closed"),
'error');
} else {
UI.showStatus(_("Failed to connect to server"), 'error');
}
} else if (UI.getSetting('reconnect', false) === true && !UI.inhibit_reconnect) {
UI.updateVisualState('reconnecting');