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

Side by Side Diff: build/android/pylib/device/device_errors.py

Issue 1077173002: [Android] Tune DeviceUtils commands that are prone to large outputs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and fix SingleQuote Created 5 years, 8 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 | build/android/pylib/device/device_utils.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """ 5 """
6 Exception classes raised by AdbWrapper and DeviceUtils. 6 Exception classes raised by AdbWrapper and DeviceUtils.
7 """ 7 """
8 8
9 from pylib import cmd_helper 9 from pylib import cmd_helper
10 from pylib.utils import base_error 10 from pylib.utils import base_error
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 class AdbShellCommandFailedError(AdbCommandFailedError): 52 class AdbShellCommandFailedError(AdbCommandFailedError):
53 """Exception for shell command failures run via adb.""" 53 """Exception for shell command failures run via adb."""
54 54
55 def __init__(self, command, output, status, device_serial=None): 55 def __init__(self, command, output, status, device_serial=None):
56 self.command = command 56 self.command = command
57 message = ['shell command run via adb failed on the device:\n', 57 message = ['shell command run via adb failed on the device:\n',
58 ' command: %s\n' % command] 58 ' command: %s\n' % command]
59 message.append(' exit status: %s\n' % status) 59 message.append(' exit status: %s\n' % status)
60 if output: 60 if output:
61 message.append(' output:\n') 61 message.append(' output:\n')
62 message.extend(' - %s\n' % line for line in output.splitlines()) 62 if isinstance(output, basestring):
63 output_lines = output.splitlines()
64 else:
65 output_lines = output
66 message.extend(' - %s\n' % line for line in output_lines)
63 else: 67 else:
64 message.append(" output: ''\n") 68 message.append(" output: ''\n")
65 message = ''.join(message) 69 message = ''.join(message)
66 super(AdbShellCommandFailedError, self).__init__( 70 super(AdbShellCommandFailedError, self).__init__(
67 ['shell', command], output, status, device_serial, message) 71 ['shell', command], output, status, device_serial, message)
68 72
69 73
70 class CommandTimeoutError(base_error.BaseError): 74 class CommandTimeoutError(base_error.BaseError):
71 """Exception for command timeouts.""" 75 """Exception for command timeouts."""
72 pass 76 pass
73 77
74 78
75 class DeviceUnreachableError(base_error.BaseError): 79 class DeviceUnreachableError(base_error.BaseError):
76 """Exception for device unreachable failures.""" 80 """Exception for device unreachable failures."""
77 pass 81 pass
78 82
79 83
80 class NoDevicesError(base_error.BaseError): 84 class NoDevicesError(base_error.BaseError):
81 """Exception for having no devices attached.""" 85 """Exception for having no devices attached."""
82 86
83 def __init__(self): 87 def __init__(self):
84 super(NoDevicesError, self).__init__('No devices attached.') 88 super(NoDevicesError, self).__init__('No devices attached.')
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698