~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: John Arbash Meinel
  • Date: 2007-07-13 02:23:34 UTC
  • mfrom: (2592 +trunk) (2612 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2614.
  • Revision ID: john@arbash-meinel.com-20070713022334-qb6ewgo6v4251yd9
[merge] bzr.dev 2612

Show diffs side-by-side

added added

removed removed

Lines of Context:
349
349
 
350
350
# XXX: Should be unified with TransportError; they seem to represent the
351
351
# same thing
 
352
# RBC 20060929: I think that unifiying with TransportError would be a mistake
 
353
# - this is finer than a TransportError - and more useful as such. It 
 
354
# differentiates between 'transport has failed' and 'operation on a transport
 
355
# has failed.'
352
356
class PathError(BzrError):
353
357
    
354
358
    _fmt = "Generic path error: %(path)r%(extra)s)"
457
461
        PathError.__init__(self, url, extra=extra)
458
462
 
459
463
 
 
464
class ReadError(PathError):
 
465
    
 
466
    _fmt = """Error reading from %(path)r."""
 
467
 
 
468
 
460
469
class ShortReadvError(PathError):
461
470
 
462
471
    _fmt = ("readv() read %(actual)s bytes rather than %(length)s bytes"
2150
2159
        self.response_tuple = response_tuple
2151
2160
 
2152
2161
 
 
2162
class ContainerError(BzrError):
 
2163
    """Base class of container errors."""
 
2164
 
 
2165
 
 
2166
class UnknownContainerFormatError(ContainerError):
 
2167
 
 
2168
    _fmt = "Unrecognised container format: %(container_format)r"
 
2169
    
 
2170
    def __init__(self, container_format):
 
2171
        self.container_format = container_format
 
2172
 
 
2173
 
 
2174
class UnexpectedEndOfContainerError(ContainerError):
 
2175
 
 
2176
    _fmt = "Unexpected end of container stream"
 
2177
 
 
2178
    internal_error = False
 
2179
 
 
2180
 
 
2181
class UnknownRecordTypeError(ContainerError):
 
2182
 
 
2183
    _fmt = "Unknown record type: %(record_type)r"
 
2184
 
 
2185
    def __init__(self, record_type):
 
2186
        self.record_type = record_type
 
2187
 
 
2188
 
 
2189
class InvalidRecordError(ContainerError):
 
2190
 
 
2191
    _fmt = "Invalid record: %(reason)s"
 
2192
 
 
2193
    def __init__(self, reason):
 
2194
        self.reason = reason
 
2195
 
 
2196
 
 
2197
class ContainerHasExcessDataError(ContainerError):
 
2198
 
 
2199
    _fmt = "Container has data after end marker: %(excess)r"
 
2200
 
 
2201
    def __init__(self, excess):
 
2202
        self.excess = excess
 
2203
 
 
2204
 
 
2205
class DuplicateRecordNameError(ContainerError):
 
2206
 
 
2207
    _fmt = "Container has multiple records with the same name: \"%(name)s\""
 
2208
 
 
2209
    def __init__(self, name):
 
2210
        self.name = name
 
2211
 
 
2212
 
2153
2213
class NoDestinationAddress(BzrError):
2154
2214
 
2155
2215
    _fmt = "Message does not have a destination address."