summaryrefslogtreecommitdiff
path: root/git/exc.py
diff options
context:
space:
mode:
authorCraig Northway <craig.northway@gmail.com>2014-07-25 11:26:48 +1000
committerCraig Northway <craig.northway@gmail.com>2014-07-25 19:19:22 +1000
commita23d0d8617ba3119069e610fc7b0850a17322726 (patch)
treed8bc5213dd7e7c7f0befdf65afecb13d5435f873 /git/exc.py
parent75194159abce545bfa38c3172efb42da9b0017dc (diff)
downloadgitpython-a23d0d8617ba3119069e610fc7b0850a17322726.tar.gz
Autopep8 fixes with maximum line length 120
Diffstat (limited to 'git/exc.py')
-rw-r--r--git/exc.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/git/exc.py b/git/exc.py
index a68486f7..8667e4b4 100644
--- a/git/exc.py
+++ b/git/exc.py
@@ -7,63 +7,78 @@
from util import to_hex_sha
+
class GitPythonError(Exception):
+
"""Base exception for all git-python related errors"""
+
class ODBError(GitPythonError):
+
"""All errors thrown by the object database"""
class InvalidDBRoot(ODBError):
+
"""Thrown if an object database cannot be initialized at the given path"""
class BadObject(ODBError):
+
"""The object with the given SHA does not exist. Instantiate with the
failed sha"""
-
+
def __str__(self):
return "BadObject: %s" % to_hex_sha(self.args[0])
class ParseError(ODBError):
+
"""Thrown if the parsing of a file failed due to an invalid format"""
class AmbiguousObjectName(ODBError):
+
"""Thrown if a possibly shortened name does not uniquely represent a single object
in the database"""
class BadObjectType(ODBError):
+
"""The object had an unsupported type"""
class UnsupportedOperation(ODBError):
+
"""Thrown if the given operation cannot be supported by the object database"""
class InvalidGitRepositoryError(InvalidDBRoot):
+
""" Thrown if the given repository appears to have an invalid format. """
class NoSuchPathError(InvalidDBRoot):
+
""" Thrown if a path could not be access by the system. """
class GitCommandError(GitPythonError):
+
""" Thrown if execution of the git command fails with non-zero status code. """
+
def __init__(self, command, status, stderr=None):
self.stderr = stderr
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))
+ (' '.join(str(i) for i in self.command), self.status, self.stderr))
class CheckoutError(GitPythonError):
+
"""Thrown if a file could not be checked out from the index as it contained
changes.
@@ -76,6 +91,7 @@ class CheckoutError(GitPythonError):
The .valid_files attribute contains a list of relative paths to files that
were checked out successfully and hence match the version stored in the
index"""
+
def __init__(self, message, failed_files, valid_files, failed_reasons):
Exception.__init__(self, message)
self.failed_files = failed_files
@@ -84,12 +100,14 @@ class CheckoutError(GitPythonError):
def __str__(self):
return Exception.__str__(self) + ":%s" % self.failed_files
-
-
+
+
class CacheError(GitPythonError):
+
"""Base for all errors related to the git index, which is called cache internally"""
class UnmergedEntriesError(CacheError):
+
"""Thrown if an operation cannot proceed as there are still unmerged
entries in the cache"""