Simplify local_host.run
+ Also preserves the original stack trace from utils.run for better
error reporting.
BUG=chromium:684311
TEST=unittests
Change-Id: If8b386fe261e03a55e7419921a9368506c25173c
Reviewed-on: https://chromium-review.googlesource.com/567758
Commit-Ready: Prathmesh Prabhu <[email protected]>
Tested-by: Prathmesh Prabhu <[email protected]>
Reviewed-by: Prathmesh Prabhu <[email protected]>
Reviewed-by: Xixuan Wu <[email protected]>
diff --git a/client/common_lib/error.py b/client/common_lib/error.py
index 4268870..f9babce 100644
--- a/client/common_lib/error.py
+++ b/client/common_lib/error.py
@@ -210,6 +210,30 @@
pass
+class AutotestHostRunCmdError(AutotestHostRunError):
+ """Indicates that the command run via Host.run failed.
+
+ This is equivalent to CmdError when raised from a Host object instead of
+ directly on the DUT using utils.run
+ """
+
+ def __init__(self, command, result_obj, additional_text=''):
+ description = command
+ if additional_text:
+ description += ' (%s)' % additional_text
+ super(AutotestHostRunCmdError, self).__init__(description, result_obj)
+ self.command = command
+ self.additional_text = additional_text
+
+
+class AutotestHostRunTimeoutError(AutotestHostRunCmdError):
+ """Indicates that a command run via Host.run timed out.
+
+ This is equivalent to CmdTimeoutError when raised from a Host object instead
+ of directly on the DUT using utils.run
+ """
+
+
# server-specific errors
class AutoservError(Exception):