From a23d0d8617ba3119069e610fc7b0850a17322726 Mon Sep 17 00:00:00 2001 From: Craig Northway Date: Fri, 25 Jul 2014 11:26:48 +1000 Subject: Autopep8 fixes with maximum line length 120 --- git/exc.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'git/exc.py') 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""" -- cgit v1.2.1