diff --git a/htdocs/frontend/javascripts/functions.js b/htdocs/frontend/javascripts/functions.js index 370bd178d..6fc5353c1 100644 --- a/htdocs/frontend/javascripts/functions.js +++ b/htdocs/frontend/javascripts/functions.js @@ -96,10 +96,10 @@ vz.getPermalink = function() { vz.load = function(args) { $.extend(args, { accepts: 'application/json', - beforeSend: function (xhr, settings) { - // remember URL for potential error messages - xhr.requestUrl = settings.url; - }, + beforeSend: function (xhr, settings) { + // remember URL for potential error messages + xhr.requestUrl = settings.url; + }, error: function(xhr) { try { var msg; @@ -112,11 +112,20 @@ vz.load = function(args) { } } else { - msg = xhr.requestUrl + ':

Unknown middleware response'; + msg = "" + xhr.requestUrl + ""; if (xhr.responseText) { msg += '

' + $(xhr.responseText).text().substring(0,300); } - throw new Exception(xhr.statusText, msg, xhr.status); + + var title = "Network Error"; + if (xhr.status > 0) { + title += " (" + xhr.status + " " + xhr.statusText + ")"; + } + else if (xhr.statusText !== "") { + title += " (" + xhr.statusText + ")"; + } + + throw new Exception(title, msg); } } catch (e) { diff --git a/htdocs/frontend/javascripts/wui.js b/htdocs/frontend/javascripts/wui.js index 92264eec8..948ed848f 100644 --- a/htdocs/frontend/javascripts/wui.js +++ b/htdocs/frontend/javascripts/wui.js @@ -834,9 +834,12 @@ vz.wui.dialogs.error = function(error, description, code) { error = code + ': ' + error; } - $('
') - .append($('').html(description)) - .dialog({ + // make error messages singleton (suppress follow-on errors) + vz.wui.errorDialog = true; + + $('
').append( + $('').html(description) + ).dialog({ title: error, width: 450, dialogClass: 'ui-error', @@ -844,6 +847,7 @@ vz.wui.dialogs.error = function(error, description, code) { modal: true, buttons: { Ok: function() { + vz.wui.errorDialog = false; $(this).dialog('close'); } } @@ -851,5 +855,6 @@ vz.wui.dialogs.error = function(error, description, code) { }; vz.wui.dialogs.exception = function(exception) { + if (vz.wui.errorDialog) return; this.error(exception.type, exception.message, exception.code); };