OLD | NEW |
---|---|
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 devil import base_error | 9 from devil import base_error |
10 from devil.utils import cmd_helper | 10 from devil.utils import cmd_helper |
(...skipping 24 matching lines...) Expand all Loading... | |
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 FastbootCommandFailedError(AdbCommandFailedError): | |
perezju
2015/10/29 10:09:52
Ohh, but not like that. Otherwise trying to catch
rnephew (Reviews Here)
2015/10/29 16:37:34
Done.
| |
46 """Exception for fastboot command failures.""" | |
47 | |
48 def __init__(self, args, output, status=None, device_serial=None, | |
49 message=None): | |
50 super(FastbootCommandFailedError, self).__init__( | |
51 args, output, status=status, message=message, | |
52 device_serial=device_serial) | |
53 | |
54 | |
45 class DeviceVersionError(CommandFailedError): | 55 class DeviceVersionError(CommandFailedError): |
46 """Exception for device version failures.""" | 56 """Exception for device version failures.""" |
47 | 57 |
48 def __init__(self, message, device_serial=None): | 58 def __init__(self, message, device_serial=None): |
49 super(DeviceVersionError, self).__init__(message, device_serial) | 59 super(DeviceVersionError, self).__init__(message, device_serial) |
50 | 60 |
51 | 61 |
52 class AdbShellCommandFailedError(AdbCommandFailedError): | 62 class AdbShellCommandFailedError(AdbCommandFailedError): |
53 """Exception for shell command failures run via adb.""" | 63 """Exception for shell command failures run via adb.""" |
54 | 64 |
(...skipping 25 matching lines...) Expand all Loading... | |
80 """Exception for device unreachable failures.""" | 90 """Exception for device unreachable failures.""" |
81 pass | 91 pass |
82 | 92 |
83 | 93 |
84 class NoDevicesError(base_error.BaseError): | 94 class NoDevicesError(base_error.BaseError): |
85 """Exception for having no devices attached.""" | 95 """Exception for having no devices attached.""" |
86 | 96 |
87 def __init__(self): | 97 def __init__(self): |
88 super(NoDevicesError, self).__init__( | 98 super(NoDevicesError, self).__init__( |
89 'No devices attached.', is_infra_error=True) | 99 'No devices attached.', is_infra_error=True) |
OLD | NEW |