Bug 942362 - Use DevToolsUtils.reportException in dbg-client.jsm; r=past
authorNick Fitzgerald <fitzgen@gmail.com>
Mon, 25 Nov 2013 10:31:46 -0800
changeset 157492 401bba5f86948b72a8a54bae813a91e1bcc16208
parent 157491 af7b718037b521ab049d6622cfbe1c57832146ef
child 157493 2c71d40fbee0ce1d35c54d77bf5daff85020ed21
push id25714
push usercbook@mozilla.com
push dateTue, 26 Nov 2013 11:39:03 +0000
treeherdermozilla-central@4a8c40940659 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs942362
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 942362 - Use DevToolsUtils.reportException in dbg-client.jsm; r=past
toolkit/devtools/client/dbg-client.jsm
--- a/toolkit/devtools/client/dbg-client.jsm
+++ b/toolkit/devtools/client/dbg-client.jsm
@@ -155,19 +155,17 @@ function eventSource(aProto) {
     let name = arguments[0];
     let listeners = this._getListeners(name).slice(0);
 
     for each (let listener in listeners) {
       try {
         listener.apply(null, arguments);
       } catch (e) {
         // Prevent a bad listener from interfering with the others.
-        let msg = e + ": " + e.stack;
-        Cu.reportError(msg);
-        dumpn(msg);
+        DevToolsUtils.reportException("notify event '" + name + "'", e);
       }
     }
   }
 }
 
 /**
  * Set of protocol messages that affect thread state, and the
  * state the actor is in after each message.
@@ -317,20 +315,17 @@ DebuggerClient.requester = function DC_r
       }
 
       // The callback is always the last parameter.
       let thisCallback = args[maxPosition + 1];
       if (thisCallback) {
         try {
           thisCallback(aResponse);
         } catch (e) {
-          let msg = "Error executing callback passed to debugger client: "
-            + e + "\n" + e.stack;
-          dumpn(msg);
-          Cu.reportError(msg);
+          DevToolsUtils.reportException("DebuggerClient.requester callback", e);
         }
       }
 
       if (histogram) {
         histogram.add(+new Date - startTime);
       }
     }.bind(this));
 
@@ -645,20 +640,20 @@ DebuggerClient.prototype = {
    */
   onPacket: function DC_onPacket(aPacket, aIgnoreCompatibility=false) {
     let packet = aIgnoreCompatibility
       ? aPacket
       : this.compat.onPacket(aPacket);
 
     resolve(packet).then(aPacket => {
       if (!aPacket.from) {
-        let msg = "Server did not specify an actor, dropping packet: " +
-                  JSON.stringify(aPacket);
-        Cu.reportError(msg);
-        dumpn(msg);
+        DevToolsUtils.reportException(
+          "onPacket",
+          new Error("Server did not specify an actor, dropping packet: " +
+                    JSON.stringify(aPacket)));
         return;
       }
 
       // If we have a registered Front for this actor, let it handle the packet
       // and skip all the rest of this unpleasantness.
       let front = this.getActor(aPacket.from);
       if (front) {
         front.onPacket(aPacket);
@@ -698,18 +693,17 @@ DebuggerClient.prototype = {
       }
 
       if (onResponse) {
         onResponse(aPacket);
       }
 
       this._sendRequests();
     }, function (ex) {
-      dumpn("Error handling response: " + ex + " - stack:\n" + ex.stack);
-      Cu.reportError(ex.message + "\n" + ex.stack);
+      DevToolsUtils.reportException("onPacket handler", ex);
     });
   },
 
   /**
    * Called by DebuggerTransport when the underlying stream is closed.
    *
    * @param aStatus nsresult
    *        The status code that corresponds to the reason for closing
@@ -825,24 +819,23 @@ ProtocolCompatibility.prototype = {
           this._featureDeferreds[feature.name].resolve(true);
           break;
         case NOT_SUPPORTED:
           this._featuresWithUnknownSupport.delete(feature);
           this._featuresWithoutSupport.add(feature);
           this.rejectFeature(feature.name);
           break;
         default:
-          Cu.reportError(new Error(
-            "Bad return value from `onPacketTest` for feature '"
-              + feature.name + "'"));
+          DevToolsUtils.reportException(
+            "PC__detectFeatures",
+            new Error("Bad return value from `onPacketTest` for feature '"
+                      + feature.name + "'"));
         }
       } catch (ex) {
-        Cu.reportError("Error detecting support for feature '"
-                       + feature.name + "':" + ex.message + "\n"
-                       + ex.stack);
+        DevToolsUtils.reportException("PC__detectFeatures", ex);
       }
     }
   },
 
   /**
    * Go through each of the features that we know are unsupported by the current
    * server and attempt to shim support.
    */
@@ -2191,19 +2184,17 @@ this.debuggerSocketConnect = function de
   // openOutputStream may throw NS_ERROR_NOT_INITIALIZED if we hit some race
   // where the nsISocketTransport gets shutdown in between its instantiation and
   // the call to this method.
   let transport;
   try {
     transport = new DebuggerTransport(s.openInputStream(0, 0, 0),
                                       s.openOutputStream(0, 0, 0));
   } catch(e) {
-    let msg = e + ": " + e.stack;
-    Cu.reportError(msg);
-    dumpn(msg);
+    DevToolsUtils.reportException("debuggerSocketConnect", e);
     throw e;
   }
   return transport;
 }
 
 /**
  * Takes a pair of items and returns them as an array.
  */