~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Martin Pool
  • Date: 2005-09-05 09:11:03 UTC
  • Revision ID: mbp@sourcefrog.net-20050905091103-1e51e146be0f08b4
- add test for deserialization from a canned XML inventory

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
######################################################################
24
24
# exceptions 
25
25
class BzrError(StandardError):
26
 
    def __str__(self):
27
 
        if len(self.args) == 1:
28
 
            return self.args[0]
29
 
        elif len(self.args) == 2:
30
 
            # further explanation or suggestions
31
 
            return '\n  '.join([self.args[0]] + self.args[1])
32
 
        else:
33
 
            return `self.args`
34
 
 
 
26
    pass
35
27
 
36
28
class BzrCheckError(BzrError):
37
29
    pass
38
30
 
39
31
 
40
32
class InvalidRevisionNumber(BzrError):
 
33
    def __init__(self, revno):
 
34
        self.args = [revno]
 
35
        
41
36
    def __str__(self):
42
37
        return 'invalid revision number: %r' % self.args[0]
43
38
 
97
92
        BzrError.__init__(self, msg)
98
93
 
99
94
 
100
 
class HistoryMissing(BzrError):
101
 
    def __init__(self, branch, object_type, object_id):
102
 
        self.branch = branch
103
 
        BzrError.__init__(self,
104
 
                          '%s is missing %s {%s}'
105
 
                          % (branch, object_type, object_id))
106
 
 
107
 
 
108
95
class UnrelatedBranches(BzrCommandError):
109
96
    def __init__(self):
110
97
        msg = "Branches have no common ancestor, and no base revision"\