Chromium Code Reviews| 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 |