From 403ed477b56695576e74f8fda1c9fc8b1df53700 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Fri, 3 Jun 2011 10:49:42 -0500 Subject: [PATCH] Fixed blank dialog box on internal error. Previously when an internal error occurs on the server the UI will display a blank error dialog box. To fix the problem the string message thrown by Ajax has been converted into an object containing the error message. Ticket #1280 --- install/ui/ipa.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/install/ui/ipa.js b/install/ui/ipa.js index 9f75f4936..4f194739b 100644 --- a/install/ui/ipa.js +++ b/install/ui/ipa.js @@ -287,13 +287,6 @@ IPA.command = function(spec) { IPA.hide_activity_icon(); - if (!error_thrown) { - error_thrown = { - name: xhr.responseText || 'Unknown Error', - message: xhr.statusText || 'Unknown Error' - }; - } - if (xhr.status === 401) { error_thrown = {}; // error_thrown is string error_thrown.name = 'Kerberos ticket no longer valid.'; @@ -307,6 +300,18 @@ IPA.command = function(spec) { ""+ "follow these directions to configure your browser."; } + + } else if (!error_thrown) { + error_thrown = { + name: xhr.responseText || 'Unknown Error', + message: xhr.statusText || 'Unknown Error' + }; + + } else if (typeof error_thrown == 'string') { + error_thrown = { + name: error_thrown, + message: error_thrown + }; } if (that.retry) { @@ -320,13 +325,12 @@ IPA.command = function(spec) { function success_handler(data, text_status, xhr) { if (!data) { - IPA.hide_activity_icon(); - var error_thrown = { + // error_handler() calls IPA.hide_activity_icon() + error_handler.call(this, xhr, text_status, /* error_thrown */ { name: 'HTTP Error '+xhr.status, url: this.url, - message: data ? xhr.statusText : "No response" - }; - dialog_open.call(this, xhr, text_status, error_thrown); + message: data ? xhr.statusText : 'No response' + }); } else if (data.error) { // error_handler() calls IPA.hide_activity_icon()