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

Unified Diff: gclient_utils.py

Issue 3320012: Improve exception handling. (Closed)
Patch Set: Created 10 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index cf2cedec5b01284653a96f57061af0dc95dce95a..04767974e1bea980270f3d9a8dffd8a73934a9f6 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -43,6 +43,18 @@ class CheckCallError(OSError, Error):
self.stdout = stdout
self.stderr = stderr
+ def __str__(self):
+ out = ' '.join(self.command)
+ if self.cwd:
+ out += ' in ' + self.cwd
+ if self.returncode is not None:
+ out += ' returned %d' % self.returncode
+ if self.stdout is not None:
+ out += '\nstdout: %s\n' % self.stdout
+ if self.stderr is not None:
+ out += '\nstderr: %s\n' % self.stderr
+ return out
+
def Popen(args, **kwargs):
"""Calls subprocess.Popen() with hacks to work around certain behaviors.
@@ -330,7 +342,7 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
filter_fn(in_line)
rv = kid.wait()
if rv:
- raise Error('failed to run command: %s' % ' '.join(args))
+ raise CheckCallError(args, kwargs.get('cwd', None), rv, None)
return 0
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698