On 06/15/2011 02:37 PM, Adam Young wrote:
Part 2

https://fedorahosted.org/freeipa/ticket/1281

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
Now iterates through a list of known error types.
From de7eac32830e2e509858b28696aeddb8e3ba1e83 Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Wed, 15 Jun 2011 14:34:54 -0400
Subject: [PATCH] no redirect on unknown error If the error name is indicates
 a server wide error, do not attempt to redirect.

https://fedorahosted.org/freeipa/ticket/1281
---
 install/ui/entity.js |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/install/ui/entity.js b/install/ui/entity.js
index 107c3c4d429fce2161ec209bb4c04d82ecea0d4c..70053fd1003e9a7c171d744253c69c8a07959205 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -136,17 +136,33 @@ IPA.facet = function (spec) {
         details.append('<p>'+error_thrown.message+'</p>');
     };
 
+    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 no_redirect_errors =
+        ["Internal Server Error",
+         "Unknown Error",
+         "Kerberos ticket no longer valid."];
+    
     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. */
+        for (var i =0; i <  no_redirect_errors.length; i += 1){
+            if (error_thrown.name ===  no_redirect_errors[i]){
+                return;
+            }
+        }
         if (that.entity.redirect_facet )
         {
-            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);
-            return;
+            that.redirect_on_error();
         }else{
             that.report_error(error_thrown);
         }
-- 
1.7.5.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to