/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 from 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
 
291
295
 
292
296
    def __init__(self, msg, base, args):
293
297
        PathError.__init__(self, base, msg)
294
 
        self.args = [base]
295
 
        self.args.extend(args)
 
298
        self.args = [base] + list(args)
296
299
 
297
300
 
298
301
class UnsupportedProtocol(PathError):
403
406
        self.bzrdir = bzrdir_format
404
407
 
405
408
 
 
409
class IncompatibleRevision(BzrNewError):
 
410
    """Revision is not compatible with %(repo_format)s"""
 
411
 
 
412
    def __init__(self, repo_format):
 
413
        BzrNewError.__init__(self)
 
414
        self.repo_format = repo_format
 
415
 
 
416
 
406
417
class NotVersionedError(BzrNewError):
407
418
    """%(path)s is not versioned"""
408
419
    def __init__(self, path):
838
849
 
839
850
# A set of semi-meaningful errors which can be thrown
840
851
class TransportNotPossible(TransportError):
841
 
    """Transport operation not possible: %(msg)s %(orig_error)%"""
 
852
    """Transport operation not possible: %(msg)s %(orig_error)s"""
842
853
 
843
854
 
844
855
class ConnectionError(TransportError):
1227
1238
        BzrNewError.__init__(self)
1228
1239
 
1229
1240
 
 
1241
class IncompatibleFormat(BzrNewError):
 
1242
    """Bundle format %(bundle_format)s is incompatible with %(other)s"""
 
1243
 
 
1244
    def __init__(self, bundle_format, other):
 
1245
        BzrNewError.__init__(self)
 
1246
        self.bundle_format = bundle_format
 
1247
        self.other = other
 
1248
 
 
1249
 
1230
1250
class BadInventoryFormat(BzrNewError):
1231
1251
    """Root class for inventory serialization errors"""
1232
1252