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

Side by Side Diff: tools/telemetry/telemetry/core/exceptions.py

Issue 1328093006: [Android][telemetry] Break logging deadlock when attempting to log an AppCrashException. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix StoryRunnerTests Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/internal/story_runner_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import sys 5 import sys
6 6
7 7
8 class Error(Exception): 8 class Error(Exception):
9 """Base class for Telemetry exceptions.""" 9 """Base class for Telemetry exceptions."""
10 def __init__(self, msg=''): 10 def __init__(self, msg=''):
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 It is possible that waiting for a longer period of time would result in a 47 It is possible that waiting for a longer period of time would result in a
48 successful operation. 48 successful operation.
49 """ 49 """
50 pass 50 pass
51 51
52 52
53 class AppCrashException(Error): 53 class AppCrashException(Error):
54 def __init__(self, app=None, msg=''): 54 def __init__(self, app=None, msg=''):
55 super(AppCrashException, self).__init__(msg) 55 super(AppCrashException, self).__init__(msg)
56 self._app = app
57 self._msg = msg 56 self._msg = msg
57 self._stack_trace = app.GetStackTrace() if app else None
58 58
59 def __str__(self): 59 def __str__(self):
60 if not self._app: 60 if not self._stack_trace:
61 return super(AppCrashException, self).__str__() 61 return super(AppCrashException, self).__str__()
62 divider = '*' * 80 62 divider = '*' * 80
63 return '%s\nStack Trace:\n%s\n\t%s\n%s' % ( 63 return '%s\nStack Trace:\n%s\n\t%s\n%s' % (
64 super(AppCrashException, self).__str__(), divider, 64 super(AppCrashException, self).__str__(), divider,
65 self._app.GetStackTrace().replace('\n', '\n\t'), divider) 65 self._stack_trace.replace('\n', '\n\t'), divider)
66 66
67 67
68 class DevtoolsTargetCrashException(AppCrashException): 68 class DevtoolsTargetCrashException(AppCrashException):
69 """Represents a crash of the current devtools target but not the overall app. 69 """Represents a crash of the current devtools target but not the overall app.
70 70
71 This can be a tab or a WebView. In this state, the tab/WebView is 71 This can be a tab or a WebView. In this state, the tab/WebView is
72 gone, but the underlying browser is still alive. 72 gone, but the underlying browser is still alive.
73 """ 73 """
74 def __init__(self, app, msg='Devtools target crashed'): 74 def __init__(self, app, msg='Devtools target crashed'):
75 super(DevtoolsTargetCrashException, self).__init__(app, msg) 75 super(DevtoolsTargetCrashException, self).__init__(app, msg)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 """ Represents an exception when encountering an unsupported Android APK. """ 122 """ Represents an exception when encountering an unsupported Android APK. """
123 123
124 124
125 class PackageDetectionError(Error): 125 class PackageDetectionError(Error):
126 """ Represents an error when parsing an Android APK's package. """ 126 """ Represents an error when parsing an Android APK's package. """
127 127
128 128
129 class AndroidDeviceParsingError(Error): 129 class AndroidDeviceParsingError(Error):
130 """Represents an error when parsing output from an android device""" 130 """Represents an error when parsing output from an android device"""
131 131
OLDNEW
« no previous file with comments | « no previous file | tools/telemetry/telemetry/internal/story_runner_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698