From 7f1049c0ee6f7f7c5d84509f9f2c5de70cd75dfb Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Tue, 12 Dec 2017 16:14:43 +0100 Subject: [PATCH] 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. --- app/ui.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/ui.js b/app/ui.js index 3c909cd2..a0190004 100644 --- a/app/ui.js +++ b/app/ui.js @@ -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'); - UI.showStatus(_("Something went wrong, connection is closed"), - 'error'); + 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');