From f40499e550ae3ed7fea534b8c657c2c76d9f6070 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 18 Apr 2017 13:29:54 -0700 Subject: [PATCH] [dashboard] improve error handling on dashboard (#2624) * [dashboard] improve error handling on dashboard * lint * More wordy error msg --- superset/assets/javascripts/modules/superset.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/superset/assets/javascripts/modules/superset.js b/superset/assets/javascripts/modules/superset.js index 434419e6fa6ae..de808858b17ea 100644 --- a/superset/assets/javascripts/modules/superset.js +++ b/superset/assets/javascripts/modules/superset.js @@ -129,10 +129,13 @@ const px = function () { let msg = ''; if (!xhr.responseText) { const status = xhr.status; - msg += 'An unknown error occurred. (Status: ' + status + ')'; if (status === 0) { // This may happen when the worker in gunicorn times out - msg += ' Maybe the request timed out?'; + msg += ( + 'The server could not be reached. You may want to ' + + 'verify your connection and try again.'); + } else { + msg += 'An unknown error occurred. (Status: ' + status + ')'; } } return msg; @@ -151,7 +154,9 @@ const px = function () { } catch (e) { // pass } - errHtml = `
${errorMsg}
`; + if (errorMsg) { + errHtml += `
${errorMsg}
`; + } if (xhr) { const extendedMsg = this.getErrorMsg(xhr); if (extendedMsg) {