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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_backend.py

Issue 959423003: Telemetry: Add more details to inspector_backend exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@telemetry_make_new_exceptions4
Patch Set: Rebase against top of tree. Created 5 years, 10 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/perf/profile_creators/fast_navigation_profile_extender.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/core/backends/chrome_inspector/inspector_backend.py
diff --git a/tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_backend.py b/tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_backend.py
index 7361a3804be7e1f4d538970b3446a5c2dbb5d9c1..886024ea10151b06d9c96cc2dc44868eb9880f13 100644
--- a/tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_backend.py
@@ -198,17 +198,52 @@ class InspectorBackend(object):
self._WaitForInspectorToGoAwayAndReconnect()
return
if res['method'] == 'Inspector.targetCrashed':
- raise exceptions.DevtoolsTargetCrashException(self.app)
+ exception = exceptions.DevtoolsTargetCrashException(self.app)
+ self._AddDebuggingInformation(exception)
+ raise exception
def _HandleError(self, error):
+ """Converts a websocket Exception into a Telemetry exception.
+
+ This method always raises a Telemetry exception. It appends debugging
+ information.
+
+ Args:
+ error: An instance of socket.error or websocket.WebSocketException.
+ Raises:
+ exception.TimeoutException: A timeout occured.
+ exception.DevtoolsTargetCrashException: On any other error, the most
+ likely explanation is that the devtool's target crashed.
+ """
+ if isinstance(error, websocket.WebSocketTimeoutException):
+ new_error = exceptions.TimeoutException()
+ else:
+ new_error = exceptions.DevtoolsTargetCrashException(self.app)
+
+ original_error_msg = 'Original exception:\n' + str(error)
+ new_error.AddDebuggingMessage(original_error_msg)
+ self._AddDebuggingInformation(new_error)
+
+ raise new_error
+
+ def _AddDebuggingInformation(self, error):
+ """Adds debugging information to error.
+
+ Args:
+ error: An instance of exceptions.Error.
+ """
if self.IsInspectable():
- raise exceptions.DevtoolsTargetCrashException(self.app,
+ msg = (
'Received a socket error in the browser connection and the tab '
- 'still exists, assuming it timed out. '
- 'Error=%s' % error)
- raise exceptions.DevtoolsTargetCrashException(self.app,
- 'Received a socket error in the browser connection and the tab no '
- 'longer exists, assuming it crashed. Error=%s' % error)
+ 'still exists. The operation probably timed out.'
+ )
+ else:
+ msg = (
+ 'Received a socket error in the browser connection and the tab no '
+ 'longer exists. The tab probably crashed.'
+ )
+ error.AddDebuggingMessage(msg)
+ error.AddDebuggingMessage('Debugger url: %s' % self.debugger_url)
def _WaitForInspectorToGoAwayAndReconnect(self):
sys.stderr.write('The connection to Chrome was lost to the Inspector UI.\n')
« no previous file with comments | « tools/perf/profile_creators/fast_navigation_profile_extender.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698