178
178
from bzrlib.weave import WeaveError
180
class TransportError(BzrError):
181
"""All errors thrown by Transport implementations should derive
184
def __init__(self, msg=None, orig_error=None):
185
if msg is None and orig_error is not None:
186
msg = str(orig_error)
187
BzrError.__init__(self, msg)
189
self.orig_error = orig_error
191
# A set of semi-meaningful errors which can be thrown
192
class TransportNotPossible(TransportError):
193
"""This is for transports where a specific function is explicitly not
194
possible. Such as pushing files to an HTTP server.
198
class NonRelativePath(TransportError):
199
"""An absolute path was supplied, that could not be decoded into
204
class NoSuchFile(TransportError, IOError):
205
"""A get() was issued for a file that doesn't exist."""
206
def __init__(self, msg=None, orig_error=None):
208
TransportError.__init__(self, msg=msg, orig_error=orig_error)
209
IOError.__init__(self, errno.ENOENT, self.msg)
211
class FileExists(TransportError, OSError):
212
"""An operation was attempted, which would overwrite an entry,
213
but overwritting is not supported.
215
mkdir() can throw this, but put() just overwites existing files.
217
def __init__(self, msg=None, orig_error=None):
219
TransportError.__init__(self, msg=msg, orig_error=orig_error)
220
OSError.__init__(self, errno.EEXIST, self.msg)
222
class PermissionDenied(TransportError):
223
"""An operation cannot succeed because of a lack of permissions."""
226
class ConnectionReset(TransportError):
227
"""The connection has been closed."""