[bitbake-devel] [PATCH 18/19] toaster: Add global ajaxError handler

Alex DAMIAN alexandru.damian at intel.com
Wed Jun 10 14:39:06 UTC 2015


From: Michael Wood <michael.g.wood at intel.com>

If any ajax calls fail and debug is enabled log the error to the console.

Signed-off-by: Michael Wood <michael.g.wood at intel.com>
---
 lib/toaster/toastergui/static/js/libtoaster.js | 5 +++++
 lib/toaster/toastergui/static/js/table.js      | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/toaster/toastergui/static/js/libtoaster.js b/lib/toaster/toastergui/static/js/libtoaster.js
index c379833..667aca2 100644
--- a/lib/toaster/toastergui/static/js/libtoaster.js
+++ b/lib/toaster/toastergui/static/js/libtoaster.js
@@ -503,6 +503,11 @@ $(document).ready(function() {
       $("#loading-notification").fadeOut();
     });
 
+    $(document).ajaxError(function(event, jqxhr, settings, errMsg){
+      console.warn("Problem with xhr call");
+      console.warn(errMsg);
+      console.warn(jqxhr.responseText);
+    });
 
     function check_for_duplicate_ids () {
       /* warn about duplicate element ids */
diff --git a/lib/toaster/toastergui/static/js/table.js b/lib/toaster/toastergui/static/js/table.js
index 45c6184..1072c75 100644
--- a/lib/toaster/toastergui/static/js/table.js
+++ b/lib/toaster/toastergui/static/js/table.js
@@ -53,11 +53,6 @@ function tableInit(ctx){
               tableData: tableData,
               tableParams: tableParams
           }, null, libtoaster.dumpsUrlParams(tableParams));
-        },
-
-        error: function (_data) {
-          console.warn("Call failed");
-          console.warn(_data);
         }
     });
   }
-- 
1.9.1




More information about the bitbake-devel mailing list