Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Unified Diff: tools/telemetry/telemetry/util/exception_formatter.py

Issue 292743020: [Telemetry] Reduce misleading spam in unittest output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/page/page_runner_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/util/exception_formatter.py
diff --git a/tools/telemetry/telemetry/util/exception_formatter.py b/tools/telemetry/telemetry/util/exception_formatter.py
index 4468b7f844efcda5ba79b9edd2479691bbe63fde..402461b5a2811f0c0f919884083af1aad5bb7170 100644
--- a/tools/telemetry/telemetry/util/exception_formatter.py
+++ b/tools/telemetry/telemetry/util/exception_formatter.py
@@ -9,10 +9,12 @@ import os
import sys
import traceback
+from telemetry.core import exceptions
from telemetry.core import util
-def PrintFormattedException(exception_class=None, exception=None, tb=None):
+def PrintFormattedException(exception_class=None, exception=None, tb=None,
+ msg=None):
if not (bool(exception_class) == bool(exception) == bool(tb)):
raise ValueError('Must specify all or none of '
'exception_class, exception, and tb')
@@ -20,6 +22,9 @@ def PrintFormattedException(exception_class=None, exception=None, tb=None):
if not exception_class:
exception_class, exception, tb = sys.exc_info()
+ if exception_class == exceptions.IntentionalException:
+ return
+
def _GetFinalFrame(tb_level):
while tb_level.tb_next:
tb_level = tb_level.tb_next
@@ -29,6 +34,11 @@ def PrintFormattedException(exception_class=None, exception=None, tb=None):
frame = _GetFinalFrame(tb)
exception_list = traceback.format_exception_only(exception_class, exception)
exception_string = '\n'.join(l.strip() for l in exception_list)
+
+ if msg:
+ print >> sys.stderr
+ print >> sys.stderr, msg
+
_PrintFormattedTrace(processed_tb, frame, exception_string)
« no previous file with comments | « tools/telemetry/telemetry/page/page_runner_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698