169
169
from bzrlib.weave import WeaveError
171
class TransportError(BzrError):
172
"""All errors thrown by Transport implementations should derive
175
def __init__(self, msg=None, orig_error=None):
176
if msg is None and orig_error is not None:
177
msg = str(orig_error)
178
BzrError.__init__(self, msg)
180
self.orig_error = orig_error
182
# A set of semi-meaningful errors which can be thrown
183
class TransportNotPossible(TransportError):
184
"""This is for transports where a specific function is explicitly not
185
possible. Such as pushing files to an HTTP server.
189
class NonRelativePath(TransportError):
190
"""An absolute path was supplied, that could not be decoded into
195
class NoSuchFile(TransportError, IOError):
196
"""A get() was issued for a file that doesn't exist."""
197
def __init__(self, msg=None, orig_error=None):
199
TransportError.__init__(self, msg=msg, orig_error=orig_error)
200
IOError.__init__(self, errno.ENOENT, self.msg)
202
class FileExists(TransportError, OSError):
203
"""An operation was attempted, which would overwrite an entry,
204
but overwritting is not supported.
206
mkdir() can throw this, but put() just overwites existing files.
208
def __init__(self, msg=None, orig_error=None):
210
TransportError.__init__(self, msg=msg, orig_error=orig_error)
211
OSError.__init__(self, errno.EEXIST, self.msg)
213
class PermissionDenied(TransportError):
214
"""An operation cannot succeed because of a lack of permissions."""
217
class ConnectionReset(TransportError):
218
"""The connection has been closed."""