Hi,

Please review the attached patch. Thanks!

The ipa_error_handler() has been modified to display the AJAX URL
that is having a problem. The ipa_cmd() error handler is now invoked
using call() to pass 'this' object which contains the URL.

--
Endi S. Dewata
>From febd03de235e5a2a458944c77fe2b2148bebf5b8 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Wed, 6 Oct 2010 15:09:14 -0500
Subject: [PATCH] Displaying AJAX URL in error message.

The ipa_error_handler() has been modified to display the AJAX URL
that is having a problem. The ipa_cmd() error handler is now invoked
using call() to pass 'this' object which contains the URL.
---
 install/static/associate.js |    1 +
 install/static/details.js   |    1 +
 install/static/ipa.js       |   19 +++++++++++--------
 install/static/search.js    |    1 +
 install/static/webui.js     |    1 +
 5 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/install/static/associate.js b/install/static/associate.js
index 826641a..49f2fd5 100644
--- a/install/static/associate.js
+++ b/install/static/associate.js
@@ -244,6 +244,7 @@ function AssociationList(obj, pkey, manyObj, associationColumns, jobj, associati
         function refresh_on_error(xhr, text_status, error_thrown) {
             var search_results = $('.search-results', jobj).empty();
             search_results.append('<p>Error: '+error_thrown.name+'</p>');
+            search_results.append('<p>URL: '+this.url+'</p>');
             search_results.append('<p>'+error_thrown.message+'</p>');
         }
 
diff --git a/install/static/details.js b/install/static/details.js
index 99666b1..62c5c5e 100644
--- a/install/static/details.js
+++ b/install/static/details.js
@@ -121,6 +121,7 @@ function ipa_details_load(jobj, pkey, on_win, on_fail)
 
         var details = $('.details', jobj).empty();
         details.append('<p>Error: '+error_thrown.name+'</p>');
+        details.append('<p>URL: '+this.url+'</p>');
         details.append('<p>'+error_thrown.message+'</p>');
     };
 
diff --git a/install/static/ipa.js b/install/static/ipa.js
index 31c9120..74fde92 100644
--- a/install/static/ipa.js
+++ b/install/static/ipa.js
@@ -80,18 +80,18 @@ function ipa_cmd(name, args, options, win_callback, fail_callback, objname)
             var error_thrown = {
                 name: 'HTTP Error '+xhr.status,
                 message: data ? xhr.statusText : "No response"
-            }
-            ipa_error_handler(xhr, text_status, error_thrown);
+            };
+            ipa_error_handler.call(this, xhr, text_status, error_thrown);
 
         } else if (data.error) {
             var error_thrown = {
                 name: 'IPA Error '+data.error.code,
                 message: data.error.message
-            }
-            ipa_error_handler(xhr, text_status, error_thrown);
+            };
+            ipa_error_handler.call(this, xhr, text_status, error_thrown);
 
         } else if (win_callback) {
-            win_callback(data, text_status, xhr);
+            win_callback.call(this, data, text_status, xhr);
         }
     }
 
@@ -99,10 +99,13 @@ function ipa_cmd(name, args, options, win_callback, fail_callback, objname)
         ipa_dialog.empty();
         ipa_dialog.attr('title', 'Error: '+error_thrown.name);
 
+        ipa_dialog.append('<p>URL: '+this.url+'</p>');
         if (error_thrown.message) {
             ipa_dialog.append('<p>'+error_thrown.message+'</p>');
         }
 
+        var that = this;
+
         ipa_dialog.dialog({
             modal: true,
             width: 400,
@@ -113,13 +116,13 @@ function ipa_cmd(name, args, options, win_callback, fail_callback, objname)
                 },
                 'Cancel': function() {
                     ipa_dialog.dialog('close');
-                    fail_callback(xhr, text_status, error_thrown);
+                    fail_callback.call(that, xhr, text_status, error_thrown);
                 }
             }
         });
-    };
+    }
 
-    id = ipa_jsonrpc_id++;
+    var id = ipa_jsonrpc_id++;
 
     var method_name = name;
 
diff --git a/install/static/search.js b/install/static/search.js
index e97632b..4b9dfad 100644
--- a/install/static/search.js
+++ b/install/static/search.js
@@ -190,6 +190,7 @@ function search_load(jobj, criteria, on_win, on_fail)
 
         var search_results = $('.search-results', jobj);
         search_results.append('<p>Error: '+error_thrown.name+'</p>');
+        search_results.append('<p>URL: '+this.url+'</p>');
         search_results.append('<p>'+error_thrown.message+'</p>');
     }
 
diff --git a/install/static/webui.js b/install/static/webui.js
index fa37bcd..9580955 100644
--- a/install/static/webui.js
+++ b/install/static/webui.js
@@ -86,6 +86,7 @@ $(function() {
     function init_on_error(xhr, text_status, error_thrown) {
         var navigation = $('#navigation').empty();
         navigation.append('<p>Error: '+error_thrown.name+'</p>');
+        navigation.append('<p>URL: '+this.url+'</p>');
         navigation.append('<p>'+error_thrown.message+'</p>');
     }
 
-- 
1.6.6.1

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

Reply via email to