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

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

Issue 1040473002: [android] Create Battery Utils to seperate power functionality (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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')
(...skipping 13 matching lines...) Expand all
68 class DeviceUnreachableError(base_error.BaseError): 75 class DeviceUnreachableError(base_error.BaseError):
69 """Exception for device unreachable failures.""" 76 """Exception for device unreachable failures."""
70 pass 77 pass
71 78
72 79
73 class NoDevicesError(base_error.BaseError): 80 class NoDevicesError(base_error.BaseError):
74 """Exception for having no devices attached.""" 81 """Exception for having no devices attached."""
75 82
76 def __init__(self): 83 def __init__(self):
77 super(NoDevicesError, self).__init__('No devices attached.') 84 super(NoDevicesError, self).__init__('No devices attached.')
OLDNEW
« no previous file with comments | « build/android/pylib/device/battery_utils_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