mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Improve exception handling.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3320012 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@58756 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user