~ubuntu-branches/ubuntu/karmic/dulwich/karmic

« back to all changes in this revision

Viewing changes to dulwich/errors.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2009-03-13 18:32:04 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090313183204-8utyjii82yhsq5gv
Tags: 0.1.1-1
* New upstream release.
* Bump standards version to 3.8.1.
* Use debhelper v5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
17
# MA  02110-1301, USA.
18
18
 
 
19
"""Dulwich-related exception classes and utility functions."""
 
20
 
19
21
class WrongObjectException(Exception):
20
 
  """Baseclass for all the _ is not a _ exceptions on objects.
21
 
 
22
 
  Do not instantiate directly.
23
 
 
24
 
  Subclasses should define a _type attribute that indicates what
25
 
  was expected if they were raised.
26
 
  """
27
 
 
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.
 
23
  
 
24
    Do not instantiate directly.
 
25
  
 
26
    Subclasses should define a _type attribute that indicates what
 
27
    was expected if they were raised.
 
28
    """
 
29
  
 
30
    def __init__(self, sha, *args, **kwargs):
 
31
        string = "%s is not a %s" % (sha, self._type)
 
32
        Exception.__init__(self, string)
 
33
 
31
34
 
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
  
 
38
    _type = 'commit'
34
39
 
35
 
  _type = 'commit'
36
40
 
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."""
 
43
  
 
44
    _type = 'tree'
39
45
 
40
 
  _type = 'tree'
41
46
 
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."""
 
49
  
 
50
    _type = 'blob'
44
51
 
45
 
  _type = 'blob'
46
52
 
47
53
class MissingCommitError(Exception):
48
 
  """Indicates that a commit was not found in the repository"""
49
 
 
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"""
 
55
  
 
56
    def __init__(self, sha, *args, **kwargs):
 
57
        Exception.__init__(self, "%s is not in the revision store" % sha)
52
58
 
53
59
 
54
60
class ObjectMissing(Exception):
55
 
  """Indicates that a requested object is missing."""
56
 
 
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."""
 
62
  
 
63
    def __init__(self, sha, *args, **kwargs):
 
64
        Exception.__init__(self, "%s is not in the pack" % sha)
59
65
 
60
66
 
61
67
class ApplyDeltaError(Exception):