summaryrefslogtreecommitdiff
path: root/git/exc.py
diff options
context:
space:
mode:
Diffstat (limited to 'git/exc.py')
-rw-r--r--git/exc.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/git/exc.py b/git/exc.py
index ba57c624..42191c62 100644
--- a/git/exc.py
+++ b/git/exc.py
@@ -7,6 +7,8 @@
from gitdb.exc import * # NOQA
+from git.compat import defenc
+
class InvalidGitRepositoryError(Exception):
@@ -29,10 +31,12 @@ class GitCommandError(Exception):
self.command = command
def __str__(self):
- 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
+ ret = "'%s' returned with exit code %i" % \
+ (' '.join(str(i) for i in self.command), self.status)
+ if self.stderr:
+ ret += "\nstderr: '%s'" % self.stderr.decode(defenc)
+ if self.stdout:
+ ret += "\nstdout: '%s'" % self.stdout.decode(defenc)
return ret