~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Aaron Bentley
  • Date: 2005-11-15 21:09:09 UTC
  • mto: (1185.33.17 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1509.
  • Revision ID: abentley@panoramicfeedback.com-20051115210909-65710970107c20a3
Throw ConnectionError instead of NoSuchFile except when we get a 404

Show diffs side-by-side

added added

removed removed

Lines of Context:
363
363
        TransportError.__init__(self, msg=msg, orig_error=orig_error)
364
364
        IOError.__init__(self, errno.ENOENT, self.msg)
365
365
 
 
366
class ConnectionError(TransportError, IOError):
 
367
    """
 
368
    A connection problem prevents file retrieval.
 
369
    This does not indicate whether the file exists or not; it indicates that a
 
370
    precondition for requesting the file was not met.
 
371
    """
 
372
 
 
373
    # XXX: Is multiple inheritance for exceptions really needed?
 
374
 
 
375
    def __str__(self):
 
376
        return 'connection error: ' + self.msg
 
377
 
 
378
    def __init__(self, msg=None, orig_error=None):
 
379
        import errno
 
380
        TransportError.__init__(self, msg=msg, orig_error=orig_error)
 
381
        IOError.__init__(self, errno.ENOENT, self.msg)
 
382
 
 
383
 
366
384
class FileExists(TransportError, OSError):
367
385
    """An operation was attempted, which would overwrite an entry,
368
386
    but overwritting is not supported.