diff options
author | Konstantin Popov <konstantin.popov.89@yandex.ru> | 2017-04-17 14:07:11 +0300 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2017-05-29 05:53:20 +0200 |
commit | 0bbcf2fc648561e4fc90ee4cc5525a3257604ec1 (patch) | |
tree | 2e0a2f7abedf693553a59c3cd544a3ed8736889d /git/exc.py | |
parent | c121f60395ce47b2c0f9e26fbc5748b4bb27802d (diff) | |
download | gitpython-0bbcf2fc648561e4fc90ee4cc5525a3257604ec1.tar.gz |
Add base class for package exceptions.
Diffstat (limited to 'git/exc.py')
-rw-r--r-- | git/exc.py | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -9,7 +9,11 @@ from gitdb.exc import * # NOQA @UnusedWildImport from git.compat import UnicodeMixin, safe_decode, string_types -class InvalidGitRepositoryError(Exception): +class GitError(Exception): + """ Base class for all package exceptions """ + + +class InvalidGitRepositoryError(GitError): """ Thrown if the given repository appears to have an invalid format. """ @@ -17,11 +21,11 @@ class WorkTreeRepositoryUnsupported(InvalidGitRepositoryError): """ Thrown to indicate we can't handle work tree repositories """ -class NoSuchPathError(OSError): +class NoSuchPathError(GitError, OSError): """ Thrown if a path could not be access by the system. """ -class CommandError(UnicodeMixin, Exception): +class CommandError(UnicodeMixin, GitError): """Base class for exceptions thrown at every stage of `Popen()` execution. :param command: @@ -74,7 +78,7 @@ class GitCommandError(CommandError): super(GitCommandError, self).__init__(command, status, stderr, stdout) -class CheckoutError(Exception): +class CheckoutError(GitError): """Thrown if a file could not be checked out from the index as it contained changes. @@ -98,7 +102,7 @@ class CheckoutError(Exception): return Exception.__str__(self) + ":%s" % self.failed_files -class CacheError(Exception): +class CacheError(GitError): """Base for all errors related to the git index, which is called cache internally""" @@ -117,7 +121,7 @@ class HookExecutionError(CommandError): self._msg = u"Hook('%s') failed%s" -class RepositoryDirtyError(Exception): +class RepositoryDirtyError(GitError): """Thrown whenever an operation on a repository fails as it has uncommitted changes that would be overwritten""" def __init__(self, repo, message): |