49
49
Base class for errors raised by bzrlib.
51
:cvar internal_error: if true (or absent) this was probably caused by a
52
bzr bug and should be displayed with a traceback; if False this was
51
:cvar internal_error: if True this was probably caused by a bzr bug and
52
should be displayed with a traceback; if False (or absent) this was
53
53
probably a user or environment error and they don't need the gory details.
54
54
(That can be overridden by -Derror on the command line.)
186
186
self.class_name = class_name
189
class IncompatibleAPI(BzrError):
191
_fmt = 'The API for "%(api)s" is not compatible with "%(wanted)s". '\
192
'It supports versions "%(minimum)s" to "%(current)s".'
194
def __init__(self, api, wanted, minimum, current):
197
self.minimum = minimum
198
self.current = current
201
class InProcessTransport(BzrError):
203
_fmt = "The transport '%(transport)s' is only accessible within this " \
206
def __init__(self, transport):
207
self.transport = transport
189
210
class InvalidEntryName(BzrError):
191
212
_fmt = "Invalid entry name: %(name)s"
322
343
_fmt = "Error in command line options"
346
class BadIndexFormatSignature(BzrError):
348
_fmt = "%(value)s is not an index of type %(_type)s."
350
def __init__(self, value, _type):
351
BzrError.__init__(self)
356
class BadIndexData(BzrError):
358
_fmt = "Error in data for index %(value)s."
360
def __init__(self, value):
361
BzrError.__init__(self)
365
class BadIndexDuplicateKey(BzrError):
367
_fmt = "The key '%(key)s' is already in index '%(index)s'."
369
def __init__(self, key, index):
370
BzrError.__init__(self)
375
class BadIndexKey(BzrError):
377
_fmt = "The key '%(key)s' is not a valid key."
379
def __init__(self, key):
380
BzrError.__init__(self)
384
class BadIndexOptions(BzrError):
386
_fmt = "Could not parse options for index %(value)s."
388
def __init__(self, value):
389
BzrError.__init__(self)
393
class BadIndexValue(BzrError):
395
_fmt = "The value '%(value)s' is not a valid value."
397
def __init__(self, value):
398
BzrError.__init__(self)
325
402
class BadOptionValue(BzrError):
327
404
_fmt = """Bad value "%(value)s" for option "%(name)s"."""
338
415
# XXX: Should be unified with TransportError; they seem to represent the
417
# RBC 20060929: I think that unifiying with TransportError would be a mistake
418
# - this is finer than a TransportError - and more useful as such. It
419
# differentiates between 'transport has failed' and 'operation on a transport
340
421
class PathError(BzrError):
342
423
_fmt = "Generic path error: %(path)r%(extra)s)"
445
526
PathError.__init__(self, url, extra=extra)
529
class ReadError(PathError):
531
_fmt = """Error reading from %(path)r."""
448
534
class ShortReadvError(PathError):
450
536
_fmt = ("readv() read %(actual)s bytes rather than %(length)s bytes"
845
931
_fmt = "No changes to commit"
934
class CannotCommitSelectedFileMerge(BzrError):
936
_fmt = 'Selected-file commit of merges is not supported yet:'\
937
' files %(files_str)s'
939
def __init__(self, files):
940
files_str = ', '.join(files)
941
BzrError.__init__(self, files=files, files_str=files_str)
848
944
class UpgradeReadonly(BzrError):
850
946
_fmt = "Upgrade URL cannot work with readonly URLs."
2026
2128
" branch location."
2131
class IllegalMergeDirectivePayload(BzrError):
2132
"""A merge directive contained something other than a patch or bundle"""
2134
_fmt = "Bad merge directive payload %(start)r"
2136
def __init__(self, start):
2141
class PatchVerificationFailed(BzrError):
2142
"""A patch from a merge directive could not be verified"""
2144
_fmt = "Preview patch does not match requested changes."
2029
2147
class PatchMissing(BzrError):
2030
2148
"""Raise a patch type was specified but no patch supplied"""
2125
2243
def __init__(self, response_tuple):
2126
2244
self.response_tuple = response_tuple
2247
class ContainerError(BzrError):
2248
"""Base class of container errors."""
2251
class UnknownContainerFormatError(ContainerError):
2253
_fmt = "Unrecognised container format: %(container_format)r"
2255
def __init__(self, container_format):
2256
self.container_format = container_format
2259
class UnexpectedEndOfContainerError(ContainerError):
2261
_fmt = "Unexpected end of container stream"
2263
internal_error = False
2266
class UnknownRecordTypeError(ContainerError):
2268
_fmt = "Unknown record type: %(record_type)r"
2270
def __init__(self, record_type):
2271
self.record_type = record_type
2274
class InvalidRecordError(ContainerError):
2276
_fmt = "Invalid record: %(reason)s"
2278
def __init__(self, reason):
2279
self.reason = reason
2282
class ContainerHasExcessDataError(ContainerError):
2284
_fmt = "Container has data after end marker: %(excess)r"
2286
def __init__(self, excess):
2287
self.excess = excess
2290
class DuplicateRecordNameError(ContainerError):
2292
_fmt = "Container has multiple records with the same name: \"%(name)s\""
2294
def __init__(self, name):
2298
class NoDestinationAddress(BzrError):
2300
_fmt = "Message does not have a destination address."
2302
internal_error = True
2305
class SMTPError(BzrError):
2307
_fmt = "SMTP error: %(error)s"
2309
def __init__(self, error):