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

Unified Diff: trunk/src/tools/telemetry/telemetry/value/failure.py

Issue 393713005: Revert 284459 "Add FailureValue and wire it through PageTestResu..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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
Index: trunk/src/tools/telemetry/telemetry/value/failure.py
===================================================================
--- trunk/src/tools/telemetry/telemetry/value/failure.py (revision 284496)
+++ trunk/src/tools/telemetry/telemetry/value/failure.py (working copy)
@@ -1,83 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import sys
-import traceback
-
-from telemetry import value as value_module
-
-class FailureValue(value_module.Value):
-
- def __init__(self, page, exc_info):
- """A value representing a failure when running the page.
-
- Args:
- page: The page where this failure occurs.
- exc_info: The exception info (sys.exc_info()) corresponding to
- this failure.
- """
- exc_type = exc_info[0].__name__
- super(FailureValue, self).__init__(page, exc_type, '', True)
- self._exc_info = exc_info
-
- @classmethod
- def FromMessage(cls, page, message):
- """Creates a failure value for a given string message.
-
- Args:
- page: The page where this failure occurs.
- message: A string message describing the failure.
- """
- try:
- raise Exception(message)
- except Exception:
- return FailureValue(page, sys.exc_info())
-
- def __repr__(self):
- if self.page:
- page_name = self.page.url
- else:
- page_name = None
- return 'FailureValue(%s, %s)' % (
- page_name, GetStringFromExcInfo(self._exc_info))
-
- @property
- def exc_info(self):
- return self._exc_info
-
- def GetBuildbotDataType(self, output_context):
- return None
-
- def GetBuildbotValue(self):
- return None
-
- def GetBuildbotMeasurementAndTraceNameForPerPageResult(self):
- return None
-
- def GetRepresentativeNumber(self):
- return None
-
- def GetRepresentativeString(self):
- return None
-
- @classmethod
- def GetJSONTypeName(cls):
- return 'failure'
-
- def AsDict(self):
- d = super(FailureValue, self).AsDict()
- d['value'] = GetStringFromExcInfo(self.exc_info)
- return d
-
- @classmethod
- def MergeLikeValuesFromSamePage(cls, values):
- assert False, 'Should not be called.'
-
- @classmethod
- def MergeLikeValuesFromDifferentPages(cls, values,
- group_by_name_suffix=False):
- assert False, 'Should not be called.'
-
-def GetStringFromExcInfo(exc_info):
- return ''.join(traceback.format_exception(*exc_info))

Powered by Google App Engine
This is Rietveld 408576698