Bug 1497686 - Better error message when a jsapi-test fails with an exception pending. r=jwalden
authorJason Orendorff <jorendorff@mozilla.com>
Wed, 10 Oct 2018 17:47:54 +0000
changeset 488950 2c21c87e773ee1bfd796079fe5ffe06c2057b9ae
parent 488949 71160e8bcfb743129388fa3d3948a8d036263785
child 488951 81dd098adbd8984f9491eae22dac152cf4fb2d71
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersjwalden
bugs1497686
milestone64.0a1
Bug 1497686 - Better error message when a jsapi-test fails with an exception pending. r=jwalden Differential Revision: https://phabricator.services.mozilla.com/D8154
js/src/jsapi-tests/tests.h
--- a/js/src/jsapi-tests/tests.h
+++ b/js/src/jsapi-tests/tests.h
@@ -223,16 +223,18 @@ class JSAPITest
     {
         char location[256];
         snprintf(location, mozilla::ArrayLength(location), "%s:%d:", filename, lineno);
 
         JSAPITestString message(location);
         message += msg;
 
         if (JS_IsExceptionPending(cx)) {
+            message += " -- ";
+
             js::gc::AutoSuppressGC gcoff(cx);
             JS::RootedValue v(cx);
             JS_GetPendingException(cx, &v);
             JS_ClearPendingException(cx);
             JSString* s = JS::ToString(cx, v);
             if (s) {
                 if (JS::UniqueChars bytes = JS_EncodeStringToLatin1(cx, s)) {
                     message += bytes.get();