diff options
Diffstat (limited to 'git/exc.py')
-rw-r--r-- | git/exc.py | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -6,8 +6,7 @@ """ Module containing all exceptions thrown througout the git package, """ from gitdb.exc import * # NOQA - -from git.compat import defenc +from git.compat import UnicodeMixin, safe_decode class InvalidGitRepositoryError(Exception): @@ -28,7 +27,7 @@ class GitCommandNotFound(Exception): pass -class GitCommandError(Exception): +class GitCommandError(UnicodeMixin, Exception): """ Thrown if execution of the git command fails with non-zero status code. """ def __init__(self, command, status, stderr=None, stdout=None): @@ -37,13 +36,13 @@ class GitCommandError(Exception): self.status = status self.command = command - def __str__(self): - ret = "'%s' returned with exit code %i" % \ - (' '.join(str(i) for i in self.command), self.status) + def __unicode__(self): + ret = u"'%s' returned with exit code %s" % \ + (u' '.join(safe_decode(i) for i in self.command), self.status) if self.stderr: - ret += "\nstderr: '%s'" % self.stderr.decode(defenc) + ret += u"\nstderr: '%s'" % safe_decode(self.stderr) if self.stdout: - ret += "\nstdout: '%s'" % self.stdout.decode(defenc) + ret += u"\nstdout: '%s'" % safe_decode(self.stdout) return ret |