From 38f4368e3031d7baab7b07972be2932e990d3694 Mon Sep 17 00:00:00 2001 From: Adam Young Date: Wed, 15 Jun 2011 14:34:54 -0400 Subject: no redirect on unknown error If the error name is indicates a server wide error, do not attempt to redirect. this variation has a whitelist of errors on which to redirect. https://fedorahosted.org/freeipa/ticket/1281 --- install/ui/entity.js | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'install/ui/entity.js') diff --git a/install/ui/entity.js b/install/ui/entity.js index c6d46ab74..7e600e4e7 100644 --- a/install/ui/entity.js +++ b/install/ui/entity.js @@ -136,20 +136,33 @@ IPA.facet = function (spec) { details.append('

'+error_thrown.message+'

'); }; + that.redirect_on_error = function(){ + var current_entity = that.entity; + while (current_entity.containing_entity){ + current_entity = current_entity.containing_entity; + } + IPA.nav.show_page( + current_entity.name, + that.entity.redirect_facet); + }; + + var redirect_errors = + ["IPA Error 4001"]; + that.on_error = function(xhr, text_status, error_thrown) { + + /*If the error is in talking to the server, don't attempt to redirect, + as there is nothing any other facet can do either. */ if (that.entity.redirect_facet ) { - var current_entity = that.entity; - while (current_entity.containing_entity){ - current_entity = current_entity.containing_entity; + for (var i =0; i < redirect_errors.length; i += 1){ + if (error_thrown.name === redirect_errors[i]){ + that.redirect_on_error(); + return; + } } - IPA.nav.show_page( - current_entity.name, - that.entity.redirect_facet); - return; - }else{ - that.report_error(error_thrown); } + that.report_error(error_thrown); }; -- cgit