~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Wouter van Heyst
  • Date: 2006-06-06 12:06:20 UTC
  • mfrom: (1740 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060606120620-50066b0951e4ef7c
merge bzr.dev 1740

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
... except:
35
35
...   print sys.exc_type
36
36
...   print sys.exc_value
37
 
...   path = getattr(sys.exc_value, 'path')
 
37
...   path = getattr(sys.exc_value, 'path', None)
38
38
...   if path is not None:
39
39
...     print path
40
40
bzrlib.errors.NotBranchError
55
55
 
56
56
from warnings import warn
57
57
 
 
58
from bzrlib.patches import (PatchSyntax, 
 
59
                            PatchConflict, 
 
60
                            MalformedPatchHeader,
 
61
                            MalformedHunkHeader,
 
62
                            MalformedLine,)
 
63
 
 
64
 
58
65
# based on Scott James Remnant's hct error classes
59
66
 
60
67
# TODO: is there any value in providing the .args field used by standard
134
141
class InvalidRevisionId(BzrNewError):
135
142
    """Invalid revision-id {%(revision_id)s} in %(branch)s"""
136
143
    def __init__(self, revision_id, branch):
 
144
        # branch can be any string or object with __str__ defined
137
145
        BzrNewError.__init__(self)
138
146
        self.revision_id = revision_id
139
147
        self.branch = branch
759
767
    """
760
768
 
761
769
 
 
770
class NoBundleFound(BzrNewError):
 
771
    """No bundle was found in %(filename)s"""
 
772
    def __init__(self, filename):
 
773
        BzrNewError.__init__(self)
 
774
        self.filename = filename
 
775
 
 
776
 
 
777
class BundleNotSupported(BzrNewError):
 
778
    """Unable to handle bundle version %(version)s: %(msg)s"""
 
779
    def __init__(self, version, msg):
 
780
        BzrNewError.__init__(self)
 
781
        self.version = version
 
782
        self.msg = msg
 
783
 
 
784
 
762
785
class MissingText(BzrNewError):
763
786
    """Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"""
764
787
 
922
945
    def __init__(self, path):
923
946
        BzrNewError.__init__(self)
924
947
        self.path = path
 
948
 
 
949
 
 
950
class TestamentMismatch(BzrNewError):
 
951
    """Testament did not match expected value.  
 
952
       For revision_id {%(revision_id)s}, expected {%(expected)s}, measured 
 
953
       {%(measured)s}
 
954
    """
 
955
    def __init__(self, revision_id, expected, measured):
 
956
        self.revision_id = revision_id
 
957
        self.expected = expected
 
958
        self.measured = measured
 
959
 
 
960
 
 
961
class BadBundle(Exception): pass
 
962
 
 
963
 
 
964
class MalformedHeader(BadBundle): pass
 
965
 
 
966
 
 
967
class MalformedPatches(BadBundle): pass
 
968
 
 
969
 
 
970
class MalformedFooter(BadBundle): pass