153
153
class StrictCommitFailed(Exception):
154
154
"""Commit refused because there are unknowns in the tree."""
157
class PathError(BzrNewError):
158
"""Generic path error: %(path)r%(extra)s)"""
159
def __init__(self, path, extra=None):
160
BzrNewError.__init__(self)
163
self.extra = ': ' + str(extra)
168
class NoSuchFile(PathError):
169
"""No such file: %(path)r%(extra)s"""
172
class FileExists(PathError):
173
"""File exists: %(path)r%(extra)s"""
176
class PermissionDenied(PathError):
177
"""Permission denied: %(path)r%(extra)s"""
180
class PathNotChild(BzrNewError):
181
"""Path %(path)r is not a child of path %(base)r%(extra)s"""
182
def __init__(self, path, base, extra=None):
183
BzrNewError.__init__(self)
187
self.extra = ': ' + str(extra)
156
192
class NotBranchError(BzrNewError):
157
193
"""Not a branch: %(path)s"""
158
194
def __init__(self, path):
357
class NonRelativePath(TransportError):
358
"""An absolute path was supplied, that could not be decoded into
363
class NoSuchFile(TransportError, IOError):
364
"""A get() was issued for a file that doesn't exist."""
366
# XXX: Is multiple inheritance for exceptions really needed?
369
return 'no such file: ' + self.msg
371
def __init__(self, msg=None, orig_error=None):
373
TransportError.__init__(self, msg=msg, orig_error=orig_error)
374
IOError.__init__(self, errno.ENOENT, self.msg)
376
class ConnectionError(TransportError, IOError):
378
A connection problem prevents file retrieval.
394
class ConnectionError(TransportError):
395
"""A connection problem prevents file retrieval.
379
396
This does not indicate whether the file exists or not; it indicates that a
380
397
precondition for requesting the file was not met.
383
# XXX: Is multiple inheritance for exceptions really needed?
386
return 'connection error: ' + self.msg
388
def __init__(self, msg=None, orig_error=None):
390
TransportError.__init__(self, msg=msg, orig_error=orig_error)
391
IOError.__init__(self, errno.ENOENT, self.msg)
394
class FileExists(TransportError, OSError):
395
"""An operation was attempted, which would overwrite an entry,
396
but overwritting is not supported.
398
mkdir() can throw this, but put() just overwites existing files.
400
# XXX: Is multiple inheritance for exceptions really needed?
401
def __init__(self, msg=None, orig_error=None):
403
TransportError.__init__(self, msg=msg, orig_error=orig_error)
404
OSError.__init__(self, errno.EEXIST, self.msg)
406
class PermissionDenied(TransportError):
407
"""An operation cannot succeed because of a lack of permissions."""
399
def __init__(self, msg=None, orig_error=None):
400
TransportError.__init__(self, msg=msg, orig_error=orig_error)
410
403
class ConnectionReset(TransportError):
411
404
"""The connection has been closed."""