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

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

Issue 670463002: Revert of New run shell implementation for DeviceUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 class BaseError(Exception): 9 class BaseError(Exception):
10 """Base exception for all device and command errors.""" 10 """Base exception for all device and command errors."""
11 pass 11 pass
12 12
13 13
14 class CommandFailedError(BaseError): 14 class CommandFailedError(BaseError):
15 """Exception for command failures.""" 15 """Exception for command failures."""
16 16
17 def __init__(self, msg, device=None): 17 def __init__(self, msg, device=None):
18 super(CommandFailedError, self).__init__( 18 super(CommandFailedError, self).__init__(
19 '%s%s' % ('(device: %s) ' % device if device else '', msg)) 19 '%s%s' % ('(device: %s) ' % device if device else '', msg))
20 20
21 21
22 class AdbCommandFailedError(CommandFailedError): 22 class AdbCommandFailedError(CommandFailedError):
23 """Exception for adb command failures.""" 23 """Exception for adb command failures."""
24 24
25 def __init__(self, cmd, msg, device=None): 25 def __init__(self, cmd, msg, device=None):
26 super(AdbCommandFailedError, self).__init__( 26 super(AdbCommandFailedError, self).__init__(
27 'adb command %r failed with message: %s' % (' '.join(cmd), msg), 27 'adb command \'%s\' failed with message: \'%s\'' % (' '.join(cmd), msg),
28 device=device) 28 device=device)
29 29
30 30
31 class AdbShellCommandFailedError(AdbCommandFailedError):
32 """Exception for adb shell command failing with non-zero return code."""
33
34 def __init__(self, cmd, return_code, output, device=None):
35 super(AdbShellCommandFailedError, self).__init__(
36 ['shell'],
37 'command %r on device failed with return code %d and output %r'
38 % (cmd, return_code, output),
39 device=device)
40 self.return_code = return_code
41 self.output = output
42
43
44 class CommandTimeoutError(BaseError): 31 class CommandTimeoutError(BaseError):
45 """Exception for command timeouts.""" 32 """Exception for command timeouts."""
46 pass 33 pass
47 34
48 35
49 class DeviceUnreachableError(BaseError): 36 class DeviceUnreachableError(BaseError):
50 """Exception for device unreachable failures.""" 37 """Exception for device unreachable failures."""
51 pass 38 pass
52 39
53 40
54 class NoDevicesError(BaseError): 41 class NoDevicesError(BaseError):
55 """Exception for having no devices attached.""" 42 """Exception for having no devices attached."""
56 43
57 def __init__(self): 44 def __init__(self):
58 super(NoDevicesError, self).__init__('No devices attached.') 45 super(NoDevicesError, self).__init__('No devices attached.')
59 46
OLDNEW
« no previous file with comments | « build/android/pylib/device/adb_wrapper_test.py ('k') | build/android/pylib/device/device_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698