16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
17
# MA 02110-1301, USA.
19
"""Dulwich-related exception classes and utility functions."""
19
21
class WrongObjectException(Exception):
20
"""Baseclass for all the _ is not a _ exceptions on objects.
22
Do not instantiate directly.
24
Subclasses should define a _type attribute that indicates what
25
was expected if they were raised.
28
def __init__(self, sha, *args, **kwargs):
29
string = "%s is not a %s" % (sha, self._type)
30
Exception.__init__(self, string)
22
"""Baseclass for all the _ is not a _ exceptions on objects.
24
Do not instantiate directly.
26
Subclasses should define a _type attribute that indicates what
27
was expected if they were raised.
30
def __init__(self, sha, *args, **kwargs):
31
string = "%s is not a %s" % (sha, self._type)
32
Exception.__init__(self, string)
32
35
class NotCommitError(WrongObjectException):
33
"""Indicates that the sha requested does not point to a commit."""
36
"""Indicates that the sha requested does not point to a commit."""
37
41
class NotTreeError(WrongObjectException):
38
"""Indicates that the sha requested does not point to a tree."""
42
"""Indicates that the sha requested does not point to a tree."""
42
47
class NotBlobError(WrongObjectException):
43
"""Indicates that the sha requested does not point to a blob."""
48
"""Indicates that the sha requested does not point to a blob."""
47
53
class MissingCommitError(Exception):
48
"""Indicates that a commit was not found in the repository"""
50
def __init__(self, sha, *args, **kwargs):
51
Exception.__init__(self, "%s is not in the revision store" % sha)
54
"""Indicates that a commit was not found in the repository"""
56
def __init__(self, sha, *args, **kwargs):
57
Exception.__init__(self, "%s is not in the revision store" % sha)
54
60
class ObjectMissing(Exception):
55
"""Indicates that a requested object is missing."""
57
def __init__(self, sha, *args, **kwargs):
58
Exception.__init__(self, "%s is not in the pack" % sha)
61
"""Indicates that a requested object is missing."""
63
def __init__(self, sha, *args, **kwargs):
64
Exception.__init__(self, "%s is not in the pack" % sha)
61
67
class ApplyDeltaError(Exception):