summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py2
-rw-r--r--tools/perf/profile_creators/fast_navigation_profile_extender.py6
-rw-r--r--tools/telemetry/telemetry/core/backends/chrome_inspector/inspector_backend.py49
3 files changed, 46 insertions, 11 deletions
diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py b/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py
index 0261b14..7fe40df 100644
--- a/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py
+++ b/tools/chrome_proxy/integration_tests/chrome_proxy_measurements.py
@@ -93,7 +93,7 @@ class ChromeProxyValidation(page_test.PageTest):
if self._expect_timeout:
raise metrics.ChromeProxyMetricException, (
'Timeout was expected, but did not occur')
- except exceptions.DevtoolsTargetCrashException, e:
+ except exceptions.TimeoutException as e:
if self._expect_timeout:
logging.warning('Navigation timeout on page %s',
page.name if page.name else page.url)
diff --git a/tools/perf/profile_creators/fast_navigation_profile_extender.py b/tools/perf/profile_creators/fast_navigation_profile_extender.py
index e490403..abcc8eb 100644
--- a/tools/perf/profile_creators/fast_navigation_profile_extender.py
+++ b/tools/perf/profile_creators/fast_navigation_profile_extender.py
@@ -161,7 +161,7 @@ class FastNavigationProfileExtender(object):
"""Retrives the URL of the tab."""
try:
return tab.EvaluateJavaScript('document.URL', timeout)
- except (exceptions.DevtoolsTargetCrashException,
+ except (exceptions.Error,
devtools_http.DevToolsClientConnectionError,
devtools_http.DevToolsClientUrlError):
return None
@@ -204,7 +204,7 @@ class FastNavigationProfileExtender(object):
try:
tab.Navigate(url, None, timeout_in_seconds)
- except (exceptions.DevtoolsTargetCrashException,
+ except (exceptions.Error,
devtools_http.DevToolsClientConnectionError,
devtools_http.DevToolsClientUrlError):
# We expect a time out. It's possible for other problems to arise, but
@@ -242,7 +242,7 @@ class FastNavigationProfileExtender(object):
except exceptions.TimeoutException:
# Ignore time outs.
pass
- except (exceptions.DevtoolsTargetCrashException,
+ except (exceptions.Error,
devtools_http.DevToolsClientConnectionError,
devtools_http.DevToolsClientUrlError):
# If any error occurs, remove the tab. it's probably in an
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 7361a38..886024e 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')