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

Unified Diff: tools/telemetry/telemetry/core/exceptions.py

Issue 282223004: [Telemetry] Ensure we try to get browser crash stacks everywhere. (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
Index: tools/telemetry/telemetry/core/exceptions.py
diff --git a/tools/telemetry/telemetry/core/exceptions.py b/tools/telemetry/telemetry/core/exceptions.py
index 8e1915e3841f100bf351bc8e958e6dae7e11b9a3..7837adb0abefd55450897fb15db43bbe831e5852 100644
--- a/tools/telemetry/telemetry/core/exceptions.py
+++ b/tools/telemetry/telemetry/core/exceptions.py
@@ -2,30 +2,55 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-class BrowserGoneException(Exception):
+
+class NativeBrowserCrashException(Exception):
+ def __init__(self, browser=None, msg=''):
+ super(NativeBrowserCrashException, self).__init__(msg)
+ self._browser = browser
+ self._msg = msg
+
+ def __str__(self):
+ if not self._browser:
+ return super(NativeBrowserCrashException, self).__str__()
+ divider = '*' * 80
+ return '%s\nStack Trace:\n%s\n\t%s\n%s' % (
+ super(NativeBrowserCrashException, self).__str__(), divider,
+ self._browser.GetStackTrace().replace('\n', '\n\t'), divider)
+
+
+class TabCrashException(NativeBrowserCrashException):
+ """Represents a crash of the current tab, but not the overall browser.
+
+ In this state, the tab is gone, but the underlying browser is still alive."""
+ def __init__(self, browser, msg='Tab crashed'):
+ super(TabCrashException, self).__init__(browser, msg)
+
+
+class BrowserGoneException(NativeBrowserCrashException):
"""Represents a crash of the entire browser.
In this state, all bets are pretty much off."""
- pass
+ def __init__(self, browser, msg='Browser crashed'):
+ super(BrowserGoneException, self).__init__(browser, msg)
+
class BrowserConnectionGoneException(BrowserGoneException):
achuithb 2014/05/15 18:10:22 Should this inherit from NativeBrowserCrashExcepti
dtu 2014/05/15 21:56:45 Maybe it should be the reverse, BrowserGone should
- pass
+ """Represents a browser that still exists but cannot be reached."""
+ def __init__(self, browser, msg='Browser exists but the connection is gone'):
+ super(BrowserConnectionGoneException, self).__init__(browser, msg)
-class ProcessGoneException(Exception):
- """Represents a process that no longer exists."""
- pass
-class TabCrashException(Exception):
- """Represents a crash of the current tab, but not the overall browser.
+class ProcessGoneException(Exception):
+ """Represents a process that no longer exists for an unknown reason."""
- In this state, the tab is gone, but the underlying browser is still alive."""
- pass
class LoginException(Exception):
pass
+
class EvaluateException(Exception):
pass
+
class ProfilingException(Exception):
pass

Powered by Google App Engine
This is Rietveld 408576698