changeset 95:f3ca3459a28b

added error reporter for bugzilla REST API errors
author Atul Varma <avarma@mozilla.com>
date Mon, 26 Apr 2010 22:10:25 -0700
parents 5ea520acc44e
children 7650ac903036
files js/modules/app.js
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/js/modules/app.js	Mon Apr 26 21:58:48 2010 -0700
+++ b/js/modules/app.js	Mon Apr 26 22:10:25 2010 -0700
@@ -91,6 +91,13 @@
     require("app/errors").log("bugzilla-api-error");
   }
 
+  function onLoad(event) {
+    var xhr = event.target;
+    var response = JSON.parse(xhr.responseText);
+    if (response.error)
+      require("app/errors").log("bugzilla-api-error");
+  }
+
   exports.create = function(Bugzilla) {
     function AuthenticatedBugzilla() {
       this.ajax = function ajax(options) {
@@ -105,6 +112,7 @@
 
         var xhr = Bugzilla.ajax.call(this, options);
 
+        xhr.addEventListener("load", onLoad, false);
         xhr.addEventListener("error", onError, false);
 
         return xhr;