/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
>>> try:
45
45
...   raise NotBranchError(path='/foo/bar')
46
46
... except:
47
 
...   print sys.exc_type
 
47
...   print '%s.%s' % (sys.exc_type.__module__, sys.exc_type.__name__)
48
48
...   print sys.exc_value
49
49
...   path = getattr(sys.exc_value, 'path', None)
50
50
...   if path is not None:
96
96
class BzrError(StandardError):
97
97
    
98
98
    is_user_error = True
99
 
    
 
99
 
100
100
    def __str__(self):
101
101
        # XXX: Should we show the exception class in 
102
102
        # exceptions that don't provide their own message?  
120
120
    # base classes should override the docstring with their human-
121
121
    # readable explanation
122
122
 
123
 
    def __init__(self, **kwds):
 
123
    def __init__(self, *args, **kwds):
 
124
        # XXX: Use the underlying BzrError to always generate the args attribute
 
125
        # if it doesn't exist.  We can't use super here, because exceptions are
 
126
        # old-style classes in python2.4 (but new in 2.5).  --bmc, 20060426
 
127
        BzrError.__init__(self, *args)
124
128
        for key, value in kwds.items():
125
129
            setattr(self, key, value)
126
130
 
283
287
 
284
288
    def __init__(self, msg, base, args):
285
289
        PathError.__init__(self, base, msg)
286
 
        self.args = [base]
287
 
        self.args.extend(args)
 
290
        self.args = [base] + list(args)
288
291
 
289
292
 
290
293
class UnsupportedProtocol(PathError):
395
398
        self.bzrdir = bzrdir_format
396
399
 
397
400
 
 
401
class IncompatibleRevision(BzrNewError):
 
402
    """Revision is not compatible with %(repo_format)s"""
 
403
 
 
404
    def __init__(self, repo_format):
 
405
        BzrNewError.__init__(self)
 
406
        self.repo_format = repo_format
 
407
 
 
408
 
398
409
class NotVersionedError(BzrNewError):
399
410
    """%(path)s is not versioned"""
400
411
    def __init__(self, path):
820
831
 
821
832
# A set of semi-meaningful errors which can be thrown
822
833
class TransportNotPossible(TransportError):
823
 
    """Transport operation not possible: %(msg)s %(orig_error)%"""
 
834
    """Transport operation not possible: %(msg)s %(orig_error)s"""
824
835
 
825
836
 
826
837
class ConnectionError(TransportError):
1185
1196
        BzrNewError.__init__(self)
1186
1197
 
1187
1198
 
 
1199
class IncompatibleFormat(BzrNewError):
 
1200
    """Bundle format %(bundle_format)s is incompatible with %(other)s"""
 
1201
 
 
1202
    def __init__(self, bundle_format, other):
 
1203
        BzrNewError.__init__(self)
 
1204
        self.bundle_format = bundle_format
 
1205
        self.other = other
 
1206
 
 
1207
 
1188
1208
class BadInventoryFormat(BzrNewError):
1189
1209
    """Root class for inventory serialization errors"""
1190
1210