summaryrefslogtreecommitdiff
path: root/git/exc.py
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2014-11-12 09:24:55 +0100
committerSebastian Thiel <byronimo@gmail.com>2014-11-12 09:24:55 +0100
commit678821a036c04dfbe331d238a7fe0223e8524901 (patch)
tree708069fc19fbfbdde1875c1c98b897132d9eba7f /git/exc.py
parent6404168e6f990462c32dbe5c7ac1ec186f88c648 (diff)
parent48f5476867d8316ee1af55e0e7cfacacbdf0ad68 (diff)
downloadgitpython-678821a036c04dfbe331d238a7fe0223e8524901.tar.gz
Merge pull request #198 from folti/0.3
GitRunCommand exception can store stdout output too.
Diffstat (limited to 'git/exc.py')
-rw-r--r--git/exc.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/git/exc.py b/git/exc.py
index 3b3091e2..76d3d486 100644
--- a/git/exc.py
+++ b/git/exc.py
@@ -17,14 +17,18 @@ class NoSuchPathError(OSError):
class GitCommandError(Exception):
""" Thrown if execution of the git command fails with non-zero status code. """
- def __init__(self, command, status, stderr=None):
+ def __init__(self, command, status, stderr=None, stdout=None):
self.stderr = stderr
+ self.stdout = stdout
self.status = status
self.command = command
def __str__(self):
- return ("'%s' returned exit status %i: %s" %
- (' '.join(str(i) for i in self.command), self.status, self.stderr))
+ ret = "'%s' returned exit status %i: %s" % \
+ (' '.join(str(i) for i in self.command), self.status, self.stderr)
+ if self.stdout is not None:
+ ret += "\nstdout: %s" % self.stdout
+ return ret
class CheckoutError( Exception ):