Bug 463122 - Improve xpcshell error reporting for generic exceptions caught at the top level. r=ted
authorJosh Matthews <josh@joshmatthews.net>
Wed, 28 Dec 2011 11:57:28 -0500
changeset 84692 c99ee2ec1016c0a8932307d338dde6ee40330217
parent 84691 ec375c6888311d5ee924571f14a92fc48048eb5b
child 84693 cc8c5e6dad1e2c4698c4c338254e7e39aae6afae
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs463122
milestone12.0a1
Bug 463122 - Improve xpcshell error reporting for generic exceptions caught at the top level. r=ted
testing/xpcshell/head.js
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -329,17 +329,26 @@ function _execute_test() {
   } catch (e) {
     _passed = false;
     // do_check failures are already logged and set _quit to true and throw
     // NS_ERROR_ABORT. If both of those are true it is likely this exception
     // has already been logged so there is no need to log it again. It's
     // possible that this will mask an NS_ERROR_ABORT that happens after a
     // do_check failure though.
     if (!_quit || e != Components.results.NS_ERROR_ABORT) {
-      msg = "TEST-UNEXPECTED-FAIL | (xpcshell/head.js) | " + e;
+      msg = "TEST-UNEXPECTED-FAIL | ";
+      if ('fileName' in e) {
+        msg += e.fileName;
+        if ('lineNumber' in e) {
+          msg += ":" + e.lineNumber;
+        }
+      } else {
+        msg += "xpcshell/head.js";
+      }
+      msg += " | " + e;
       if (e.stack) {
         _dump(msg + " - See following stack:\n");
         _dump_exception_stack(e.stack);
       }
       else {
         _dump(msg + "\n");
       }
     }