/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:
46
46
 
47
47
 * the printable form of an exception is generated by the base class
48
48
   __str__ method
 
49
 
 
50
Exception strings should start with a capital letter and not have a final
 
51
fullstop.
49
52
"""
50
53
 
51
54
# based on Scott James Remnant's hct error classes
133
136
    def __init__(self, base):
134
137
        BzrNewError.__init__(self)
135
138
        self.base = base
136
 
        
 
139
 
 
140
 
137
141
class BzrCommandError(BzrError):
138
142
    # Error from malformed user command
139
143
    # This is being misused as a generic exception
369
373
        TransportError.__init__(self, msg=msg, orig_error=orig_error)
370
374
        IOError.__init__(self, errno.ENOENT, self.msg)
371
375
 
 
376
class ConnectionError(TransportError, IOError):
 
377
    """
 
378
    A connection problem prevents file retrieval.
 
379
    This does not indicate whether the file exists or not; it indicates that a
 
380
    precondition for requesting the file was not met.
 
381
    """
 
382
 
 
383
    # XXX: Is multiple inheritance for exceptions really needed?
 
384
 
 
385
    def __str__(self):
 
386
        return 'connection error: ' + self.msg
 
387
 
 
388
    def __init__(self, msg=None, orig_error=None):
 
389
        import errno
 
390
        TransportError.__init__(self, msg=msg, orig_error=orig_error)
 
391
        IOError.__init__(self, errno.ENOENT, self.msg)
 
392
 
 
393
 
372
394
class FileExists(TransportError, OSError):
373
395
    """An operation was attempted, which would overwrite an entry,
374
396
    but overwritting is not supported.
422
444
        BzrNewError.__init__(self)
423
445
        self.graph = graph
424
446
 
 
447
class NotConflicted(BzrNewError):
 
448
    """File %(filename)s is not conflicted."""
 
449
    def __init__(self, filename):
 
450
        BzrNewError.__init__(self)
 
451
        self.filename = filename
 
452
 
425
453
class MustUseDecorated(Exception):
426
454
    """A decorating function has requested its original command be used.
427
455