/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Martin Pool
  • Date: 2007-08-20 05:53:39 UTC
  • mfrom: (2727 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2730.
  • Revision ID: mbp@sourcefrog.net-20070820055339-uzei7f7i7jo6tugg
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    """
49
49
    Base class for errors raised by bzrlib.
50
50
 
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.)
55
55
 
186
186
        self.class_name = class_name
187
187
 
188
188
 
 
189
class IncompatibleAPI(BzrError):
 
190
 
 
191
    _fmt = 'The API for "%(api)s" is not compatible with "%(wanted)s". '\
 
192
        'It supports versions "%(minimum)s" to "%(current)s".'
 
193
 
 
194
    def __init__(self, api, wanted, minimum, current):
 
195
        self.api = api
 
196
        self.wanted = wanted
 
197
        self.minimum = minimum
 
198
        self.current = current
 
199
 
 
200
 
 
201
class InProcessTransport(BzrError):
 
202
 
 
203
    _fmt = "The transport '%(transport)s' is only accessible within this " \
 
204
        "process."
 
205
 
 
206
    def __init__(self, transport):
 
207
        self.transport = transport
 
208
 
 
209
 
189
210
class InvalidEntryName(BzrError):
190
211
    
191
212
    _fmt = "Invalid entry name: %(name)s"
322
343
    _fmt = "Error in command line options"
323
344
 
324
345
 
 
346
class BadIndexFormatSignature(BzrError):
 
347
 
 
348
    _fmt = "%(value)s is not an index of type %(_type)s."
 
349
 
 
350
    def __init__(self, value, _type):
 
351
        BzrError.__init__(self)
 
352
        self.value = value
 
353
        self._type = _type
 
354
 
 
355
 
 
356
class BadIndexData(BzrError):
 
357
 
 
358
    _fmt = "Error in data for index %(value)s."
 
359
 
 
360
    def __init__(self, value):
 
361
        BzrError.__init__(self)
 
362
        self.value = value
 
363
 
 
364
 
 
365
class BadIndexDuplicateKey(BzrError):
 
366
 
 
367
    _fmt = "The key '%(key)s' is already in index '%(index)s'."
 
368
 
 
369
    def __init__(self, key, index):
 
370
        BzrError.__init__(self)
 
371
        self.key = key
 
372
        self.index = index
 
373
 
 
374
 
 
375
class BadIndexKey(BzrError):
 
376
 
 
377
    _fmt = "The key '%(key)s' is not a valid key."
 
378
 
 
379
    def __init__(self, key):
 
380
        BzrError.__init__(self)
 
381
        self.key = key
 
382
 
 
383
 
 
384
class BadIndexOptions(BzrError):
 
385
 
 
386
    _fmt = "Could not parse options for index %(value)s."
 
387
 
 
388
    def __init__(self, value):
 
389
        BzrError.__init__(self)
 
390
        self.value = value
 
391
 
 
392
 
 
393
class BadIndexValue(BzrError):
 
394
 
 
395
    _fmt = "The value '%(value)s' is not a valid value."
 
396
 
 
397
    def __init__(self, value):
 
398
        BzrError.__init__(self)
 
399
        self.value = value
 
400
 
 
401
 
325
402
class BadOptionValue(BzrError):
326
403
 
327
404
    _fmt = """Bad value "%(value)s" for option "%(name)s"."""
337
414
 
338
415
# XXX: Should be unified with TransportError; they seem to represent the
339
416
# same thing
 
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
 
420
# has failed.'
340
421
class PathError(BzrError):
341
422
    
342
423
    _fmt = "Generic path error: %(path)r%(extra)s)"
445
526
        PathError.__init__(self, url, extra=extra)
446
527
 
447
528
 
 
529
class ReadError(PathError):
 
530
    
 
531
    _fmt = """Error reading from %(path)r."""
 
532
 
 
533
 
448
534
class ShortReadvError(PathError):
449
535
 
450
536
    _fmt = ("readv() read %(actual)s bytes rather than %(length)s bytes"
459
545
        self.actual = actual
460
546
 
461
547
 
462
 
class PathNotChild(BzrError):
 
548
class PathNotChild(PathError):
463
549
 
464
550
    _fmt = "Path %(path)r is not a child of path %(base)r%(extra)s"
465
551
 
876
962
 
877
963
class NoSuchRevision(BzrError):
878
964
 
879
 
    _fmt = "Branch %(branch)s has no revision %(revision)s"
 
965
    _fmt = "%(branch)s has no revision %(revision)s"
880
966
 
881
967
    internal_error = True
882
968
 
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)
885
972
 
886
973
 
 
974
# zero_ninetyone: this exception is no longer raised and should be removed
887
975
class NotLeftParentDescendant(BzrError):
888
976
 
889
977
    _fmt = ("Revision %(old_revision)s is not the left parent of"
1186
1274
        self.file_id = file_id
1187
1275
 
1188
1276
 
 
1277
class VersionedFileInvalidChecksum(VersionedFileError):
 
1278
 
 
1279
    _fmt = "Text did not match its checksum: %(message)s"
 
1280
 
 
1281
 
1189
1282
class KnitError(BzrError):
1190
1283
    
1191
1284
    _fmt = "Knit error"
1534
1627
        self.text_revision = text_revision
1535
1628
        self.file_id = file_id
1536
1629
 
1537
 
 
1538
1630
class DuplicateFileId(BzrError):
1539
1631
 
1540
1632
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1579
1671
 
1580
1672
    _fmt = "Bad parameter: %(param)r"
1581
1673
 
 
1674
    internal_error = True
 
1675
 
1582
1676
    # This exception should never be thrown, but it is a base class for all
1583
1677
    # parameter-to-function errors.
1584
1678
 
2036
2130
        " branch location."
2037
2131
 
2038
2132
 
 
2133
class IllegalMergeDirectivePayload(BzrError):
 
2134
    """A merge directive contained something other than a patch or bundle"""
 
2135
 
 
2136
    _fmt = "Bad merge directive payload %(start)r"
 
2137
 
 
2138
    def __init__(self, start):
 
2139
        BzrError(self)
 
2140
        self.start = start
 
2141
 
 
2142
 
 
2143
class PatchVerificationFailed(BzrError):
 
2144
    """A patch from a merge directive could not be verified"""
 
2145
 
 
2146
    _fmt = "Preview patch does not match requested changes."
 
2147
 
 
2148
 
2039
2149
class PatchMissing(BzrError):
2040
2150
    """Raise a patch type was specified but no patch supplied"""
2041
2151
 
2134
2244
 
2135
2245
    def __init__(self, response_tuple):
2136
2246
        self.response_tuple = response_tuple
 
2247
 
 
2248
 
 
2249
class ContainerError(BzrError):
 
2250
    """Base class of container errors."""
 
2251
 
 
2252
 
 
2253
class UnknownContainerFormatError(ContainerError):
 
2254
 
 
2255
    _fmt = "Unrecognised container format: %(container_format)r"
 
2256
    
 
2257
    def __init__(self, container_format):
 
2258
        self.container_format = container_format
 
2259
 
 
2260
 
 
2261
class UnexpectedEndOfContainerError(ContainerError):
 
2262
 
 
2263
    _fmt = "Unexpected end of container stream"
 
2264
 
 
2265
    internal_error = False
 
2266
 
 
2267
 
 
2268
class UnknownRecordTypeError(ContainerError):
 
2269
 
 
2270
    _fmt = "Unknown record type: %(record_type)r"
 
2271
 
 
2272
    def __init__(self, record_type):
 
2273
        self.record_type = record_type
 
2274
 
 
2275
 
 
2276
class InvalidRecordError(ContainerError):
 
2277
 
 
2278
    _fmt = "Invalid record: %(reason)s"
 
2279
 
 
2280
    def __init__(self, reason):
 
2281
        self.reason = reason
 
2282
 
 
2283
 
 
2284
class ContainerHasExcessDataError(ContainerError):
 
2285
 
 
2286
    _fmt = "Container has data after end marker: %(excess)r"
 
2287
 
 
2288
    def __init__(self, excess):
 
2289
        self.excess = excess
 
2290
 
 
2291
 
 
2292
class DuplicateRecordNameError(ContainerError):
 
2293
 
 
2294
    _fmt = "Container has multiple records with the same name: \"%(name)s\""
 
2295
 
 
2296
    def __init__(self, name):
 
2297
        self.name = name
 
2298
 
 
2299
 
 
2300
class NoDestinationAddress(BzrError):
 
2301
 
 
2302
    _fmt = "Message does not have a destination address."
 
2303
 
 
2304
    internal_error = True
 
2305
 
 
2306
 
 
2307
class SMTPError(BzrError):
 
2308
 
 
2309
    _fmt = "SMTP error: %(error)s"
 
2310
 
 
2311
    def __init__(self, error):
 
2312
        self.error = error
 
2313
 
 
2314
 
 
2315
class SMTPConnectionRefused(SMTPError):
 
2316
 
 
2317
    _fmt = "SMTP connection to %(host)s refused"
 
2318
 
 
2319
    def __init__(self, error, host):
 
2320
        self.error = error
 
2321
        self.host = host
 
2322
 
 
2323
 
 
2324
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
 
2325
 
 
2326
    _fmt = "Please specify smtp_server.  No server at default %(host)s."