~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 21:07:17 UTC
  • mfrom: (1393.1.6)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: abentley@panoramicfeedback.com-20050929210717-cd73981590f17017
Merged the weave changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
######################################################################
23
23
# exceptions 
24
24
class BzrError(StandardError):
25
 
    pass
 
25
    def __str__(self):
 
26
        if len(self.args) == 1:
 
27
            return self.args[0]
 
28
        elif len(self.args) == 2:
 
29
            # further explanation or suggestions
 
30
            return '\n  '.join([self.args[0]] + self.args[1])
 
31
        else:
 
32
            return `self.args`
26
33
 
27
34
 
28
35
class BzrCheckError(BzrError):
30
37
 
31
38
 
32
39
class InvalidRevisionNumber(BzrError):
33
 
    def __init__(self, revno):
34
 
        self.args = [revno]
35
 
        
36
40
    def __str__(self):
37
41
        return 'invalid revision number: %r' % self.args[0]
38
42
 
92
96
        BzrError.__init__(self, msg)
93
97
 
94
98
 
 
99
class HistoryMissing(BzrError):
 
100
    def __init__(self, branch, object_type, object_id):
 
101
        self.branch = branch
 
102
        BzrError.__init__(self,
 
103
                          '%s is missing %s {%s}'
 
104
                          % (branch, object_type, object_id))
 
105
 
 
106
 
95
107
class DivergedBranches(BzrError):
96
108
    def __init__(self, branch1, branch2):
97
109
        BzrError.__init__(self, "These branches have diverged.")
98
110
        self.branch1 = branch1
99
111
        self.branch2 = branch2
100
112
 
 
113
 
101
114
class UnrelatedBranches(BzrCommandError):
102
115
    def __init__(self):
103
116
        msg = "Branches have no common ancestor, and no base revision"\
151
164
class UnlistableBranch(BzrError):
152
165
    def __init__(self, br):
153
166
        BzrError.__init__(self, "Stores for branch %s are not listable" % br)
 
167
 
 
168
 
 
169
from bzrlib.weave import WeaveError