Bug 802924: fix issue when sending telemetry metric for certain exceptions (p=gcomninos,r=throdrig,r=rulohani)
authorDan Schaffer <Dan.Schaffer@adobe.com>
Thu, 25 Oct 2012 06:53:32 -0700
changeset 7572 24549a74fde9
parent 7571 d9197807ec41
child 7573 bf1fa4452689
push id4262
push userdschaffe@adobe.com
push dateWed, 30 Jan 2013 19:01:31 +0000
reviewersthrodrig, rulohani
bugs802924, 1126795, 1128992
Bug 802924: fix issue when sending telemetry metric for certain exceptions (p=gcomninos,r=throdrig,r=rulohani) integrate CL 1126795 CL@1128992
core/AvmCore.cpp
--- a/core/AvmCore.cpp
+++ b/core/AvmCore.cpp
@@ -1594,24 +1594,34 @@ 22. Return false.
             }
         }
         #endif
 
 #ifdef VMCFG_TELEMETRY_SAMPLER
         // Send the exception info along with the stack trace over telemetry
         if (!(exception->flags & Exception::SUPPRESS_ERROR_REPORT) && getTelemetry() && getTelemetry()->IsActive()) {
             StringBuffer exceptionStringBuffer(this);
-            ScriptObject *so = atomToScriptObject(exception->atom);
-            if (so) {
-                // get the full class name including the namespace
-                so->traits()->print(exceptionStringBuffer, true);
-            } else {
+
+            bool wroteErrString = false;
+
+            if (atomKind(exception->atom) == kObjectType) {
+                // string() is not very explanatory for most Error objects.
+                // Get the full class name including the namespace instead.
+                ScriptObject *so = atomToScriptObject(exception->atom);
+                if (so) {
+                    so->traits()->print(exceptionStringBuffer, true);
+                    wroteErrString = true;
+                }
+            }
+
+            if (!wroteErrString) {
                 // backup, just convert atom to a string, it will say "Error"
                 exceptionStringBuffer << StUTF8String(string(exception->atom)).c_str();
             }
+
             exceptionStringBuffer << '\n';
 
             // Get the stack trace
             GetStackTrace(exceptionStringBuffer);
 
             // Send the metric as a string
             TELEMETRY_STRING(getTelemetry(), ".as.exception", exceptionStringBuffer.c_str());
         }