Bug 849171 - Console.jsm output of errors could be better; r=msucan
authorJoe Walker <jwalker@mozilla.com>
Thu, 09 May 2013 15:15:22 +0100
changeset 131611 0913fd986ec1bc8a22997393c589b320636b67ca
parent 131610 5db1de835843049584f741147b84f01332cceabe
child 131612 d6249744132e202e60b8dd3d756518beef692a9e
push id27916
push userdbaron@mozilla.com
push dateSun, 12 May 2013 05:05:28 +0000
treeherdermozilla-inbound@d68224f5325b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmsucan
bugs849171
milestone23.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 849171 - Console.jsm output of errors could be better; r=msucan
toolkit/devtools/Console.jsm
--- a/toolkit/devtools/Console.jsm
+++ b/toolkit/devtools/Console.jsm
@@ -182,19 +182,26 @@ function log(aThing) {
     else if (type == "Set") {
       let i = 0;
       reply += "Set\n";
       for (let value of aThing) {
         reply += logProperty('' + i, value);
         i++;
       }
     }
-    else if (type == "Error") {
-      reply += "  " + aThing.message + "\n";
-      reply += logProperty("stack", aThing.stack);
+    else if (type.match("Error$")) {
+      reply += "  Message: " + aThing + "\n";
+      if (aThing.stack) {
+        reply += "  Stack:\n";
+        var frame = aThing.stack;
+        while (frame) {
+          reply += "    " + frame + "\n";
+          frame = frame.caller;
+        }
+      }
     }
     else if (aThing instanceof Components.interfaces.nsIDOMNode && aThing.tagName) {
       reply += "  " + debugElement(aThing) + "\n";
     }
     else {
       let keys = Object.getOwnPropertyNames(aThing);
       if (keys.length > 0) {
         reply += type + "\n";