Rename retcode to returncode to be consistent with subprocess.
Change CheckCallError to inherit from Error. This will simplify try/except changes.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3324007
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@58695 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_utils.py b/gclient_utils.py
index 7558b42..cf2cede 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -27,13 +27,19 @@
import xml.parsers.expat
-class CheckCallError(OSError):
+class Error(Exception):
+ """gclient exception class."""
+ pass
+
+
+class CheckCallError(OSError, Error):
"""CheckCall() returned non-0."""
- def __init__(self, command, cwd, retcode, stdout, stderr=None):
- OSError.__init__(self, command, cwd, retcode, stdout, stderr)
+ def __init__(self, command, cwd, returncode, stdout, stderr=None):
+ OSError.__init__(self, command, cwd, returncode, stdout, stderr)
+ Error.__init__(self)
self.command = command
self.cwd = cwd
- self.retcode = retcode
+ self.returncode = returncode
self.stdout = stdout
self.stderr = stderr
@@ -111,12 +117,6 @@
return child_nodes[0].getAttribute(attribute_name)
-class Error(Exception):
- """gclient exception class."""
- # TODO(maruel): Merge with CheckCallError.
- pass
-
-
def SyntaxErrorToError(filename, e):
"""Raises a gclient_utils.Error exception with the human readable message"""
try: