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

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

Issue 1108173002: Roll //build, //native_client, and a few more targets of opportunity. Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Test fix Created 5 years, 7 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 | « build/android/pylib/device/decorators.py ('k') | 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 24 matching lines...) Expand all
35 message.append('with exit status %s ' % self.status) 35 message.append('with exit status %s ' % self.status)
36 if output: 36 if output:
37 message.append('and output:\n') 37 message.append('and output:\n')
38 message.extend('- %s\n' % line for line in output.splitlines()) 38 message.extend('- %s\n' % line for line in output.splitlines())
39 else: 39 else:
40 message.append('and no output.') 40 message.append('and no output.')
41 message = ''.join(message) 41 message = ''.join(message)
42 super(AdbCommandFailedError, self).__init__(message, device_serial) 42 super(AdbCommandFailedError, self).__init__(message, device_serial)
43 43
44 44
45 class DeviceVersionError(CommandFailedError):
46 """Exception for device version failures."""
47
48 def __init__(self, message, device_serial=None):
49 super(DeviceVersionError, self).__init__(message, device_serial)
50
51
45 class AdbShellCommandFailedError(AdbCommandFailedError): 52 class AdbShellCommandFailedError(AdbCommandFailedError):
46 """Exception for shell command failures run via adb.""" 53 """Exception for shell command failures run via adb."""
47 54
48 def __init__(self, command, output, status, device_serial=None): 55 def __init__(self, command, output, status, device_serial=None):
49 self.command = command 56 self.command = command
50 message = ['shell command run via adb failed on the device:\n', 57 message = ['shell command run via adb failed on the device:\n',
51 ' command: %s\n' % command] 58 ' command: %s\n' % command]
52 message.append(' exit status: %s\n' % status) 59 message.append(' exit status: %s\n' % status)
53 if output: 60 if output:
54 message.append(' output:\n') 61 message.append(' output:\n')
55 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)
56 else: 67 else:
57 message.append(" output: ''\n") 68 message.append(" output: ''\n")
58 message = ''.join(message) 69 message = ''.join(message)
59 super(AdbShellCommandFailedError, self).__init__( 70 super(AdbShellCommandFailedError, self).__init__(
60 ['shell', command], output, status, device_serial, message) 71 ['shell', command], output, status, device_serial, message)
61 72
62 73
63 class CommandTimeoutError(base_error.BaseError): 74 class CommandTimeoutError(base_error.BaseError):
64 """Exception for command timeouts.""" 75 """Exception for command timeouts."""
65 pass 76 pass
66 77
67 78
68 class DeviceUnreachableError(base_error.BaseError): 79 class DeviceUnreachableError(base_error.BaseError):
69 """Exception for device unreachable failures.""" 80 """Exception for device unreachable failures."""
70 pass 81 pass
71 82
72 83
73 class NoDevicesError(base_error.BaseError): 84 class NoDevicesError(base_error.BaseError):
74 """Exception for having no devices attached.""" 85 """Exception for having no devices attached."""
75 86
76 def __init__(self): 87 def __init__(self):
77 super(NoDevicesError, self).__init__('No devices attached.') 88 super(NoDevicesError, self).__init__('No devices attached.')
OLDNEW
« no previous file with comments | « build/android/pylib/device/decorators.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698