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"
877
963
class NoSuchRevision(BzrError):
879
_fmt = "Branch %(branch)s has no revision %(revision)s"
965
_fmt = "%(branch)s has no revision %(revision)s"
881
967
internal_error = True
883
969
def __init__(self, branch, revision):
970
# 'branch' may sometimes be an internal object like a KnitRevisionStore
884
971
BzrError.__init__(self, branch=branch, revision=revision)
974
# zero_ninetyone: this exception is no longer raised and should be removed
887
975
class NotLeftParentDescendant(BzrError):
889
977
_fmt = ("Revision %(old_revision)s is not the left parent of"
2036
2130
" branch location."
2133
class IllegalMergeDirectivePayload(BzrError):
2134
"""A merge directive contained something other than a patch or bundle"""
2136
_fmt = "Bad merge directive payload %(start)r"
2138
def __init__(self, start):
2143
class PatchVerificationFailed(BzrError):
2144
"""A patch from a merge directive could not be verified"""
2146
_fmt = "Preview patch does not match requested changes."
2039
2149
class PatchMissing(BzrError):
2040
2150
"""Raise a patch type was specified but no patch supplied"""
2135
2245
def __init__(self, response_tuple):
2136
2246
self.response_tuple = response_tuple
2249
class ContainerError(BzrError):
2250
"""Base class of container errors."""
2253
class UnknownContainerFormatError(ContainerError):
2255
_fmt = "Unrecognised container format: %(container_format)r"
2257
def __init__(self, container_format):
2258
self.container_format = container_format
2261
class UnexpectedEndOfContainerError(ContainerError):
2263
_fmt = "Unexpected end of container stream"
2265
internal_error = False
2268
class UnknownRecordTypeError(ContainerError):
2270
_fmt = "Unknown record type: %(record_type)r"
2272
def __init__(self, record_type):
2273
self.record_type = record_type
2276
class InvalidRecordError(ContainerError):
2278
_fmt = "Invalid record: %(reason)s"
2280
def __init__(self, reason):
2281
self.reason = reason
2284
class ContainerHasExcessDataError(ContainerError):
2286
_fmt = "Container has data after end marker: %(excess)r"
2288
def __init__(self, excess):
2289
self.excess = excess
2292
class DuplicateRecordNameError(ContainerError):
2294
_fmt = "Container has multiple records with the same name: \"%(name)s\""
2296
def __init__(self, name):
2300
class NoDestinationAddress(BzrError):
2302
_fmt = "Message does not have a destination address."
2304
internal_error = True
2307
class SMTPError(BzrError):
2309
_fmt = "SMTP error: %(error)s"
2311
def __init__(self, error):
2315
class SMTPConnectionRefused(SMTPError):
2317
_fmt = "SMTP connection to %(host)s refused"
2319
def __init__(self, error, host):
2324
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2326
_fmt = "Please specify smtp_server. No server at default %(host)s."