/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

Merge from TestCaseWithMemoryTransport.

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
            if isinstance(s, unicode):
133
133
                return s.encode('utf8')
134
134
            return s
135
 
        except (NameError, ValueError, KeyError), e:
136
 
            return 'Unprintable exception %s: %s' \
137
 
                % (self.__class__.__name__, str(e))
 
135
        except (TypeError, NameError, ValueError, KeyError), e:
 
136
            return 'Unprintable exception %s(%r): %s' \
 
137
                % (self.__class__.__name__,
 
138
                   self.__dict__, str(e))
138
139
 
139
140
 
140
141
class AlreadyBuilding(BzrNewError):
293
294
        PathError.__init__(self, url, extra=extra)
294
295
 
295
296
 
 
297
class ShortReadvError(PathError):
 
298
    """readv() read %(actual)s bytes rather than %(length)s bytes at %(offset)s for %(path)s%(extra)s"""
 
299
 
 
300
    is_user_error = False
 
301
 
 
302
    def __init__(self, path, offset, length, actual, extra=None):
 
303
        PathError.__init__(self, path, extra=extra)
 
304
        self.offset = offset
 
305
        self.length = length
 
306
        self.actual = actual
 
307
 
 
308
 
296
309
class PathNotChild(BzrNewError):
297
310
    """Path %(path)r is not a child of path %(base)r%(extra)s"""
298
311
 
798
811
        BzrNewError.__init__(self)
799
812
 
800
813
 
 
814
class SmartProtocolError(TransportError):
 
815
    """Generic bzr smart protocol error: %(details)s"""
 
816
 
 
817
    def __init__(self, details):
 
818
        self.details = details
 
819
 
 
820
 
801
821
# A set of semi-meaningful errors which can be thrown
802
822
class TransportNotPossible(TransportError):
803
823
    """Transport operation not possible: %(msg)s %(orig_error)%"""
998
1018
        self.format = format
999
1019
 
1000
1020
 
 
1021
class BadConversionTarget(BzrNewError):
 
1022
    """Cannot convert to format %(format)s.  %(problem)s"""
 
1023
 
 
1024
    def __init__(self, problem, format):
 
1025
        BzrNewError.__init__(self)
 
1026
        self.problem = problem
 
1027
        self.format = format
 
1028
 
 
1029
 
1001
1030
class NoDiff(BzrNewError):
1002
1031
    """Diff is not installed on this machine: %(msg)s"""
1003
1032
 
1156
1185
        BzrNewError.__init__(self)
1157
1186
 
1158
1187
 
 
1188
class BadInventoryFormat(BzrNewError):
 
1189
    """Root class for inventory serialization errors"""
 
1190
 
 
1191
 
 
1192
class UnexpectedInventoryFormat(BadInventoryFormat):
 
1193
    """The inventory was not in the expected format:\n %(msg)s"""
 
1194
 
 
1195
    def __init__(self, msg):
 
1196
        BadInventoryFormat.__init__(self, msg=msg)
 
1197
 
 
1198
 
 
1199
class NoSmartServer(NotBranchError):
 
1200
    """No smart server available at %(url)s"""
 
1201
 
 
1202
    def __init__(self, url):
 
1203
        self.url = url
 
1204
 
 
1205
 
1159
1206
class UnknownSSH(BzrNewError):
1160
1207
    """Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
1161
1208
 
1170
1217
    def __init__(self, revision_id):
1171
1218
        BzrNewError.__init__(self)
1172
1219
        self.revision_id = revision_id
 
1220
 
 
1221
 
 
1222
class IllegalUseOfScopeReplacer(BzrNewError):
 
1223
    """ScopeReplacer object %(name)r was used incorrectly: %(msg)s%(extra)s"""
 
1224
 
 
1225
    is_user_error = False
 
1226
 
 
1227
    def __init__(self, name, msg, extra=None):
 
1228
        BzrNewError.__init__(self)
 
1229
        self.name = name
 
1230
        self.msg = msg
 
1231
        if extra:
 
1232
            self.extra = ': ' + str(extra)
 
1233
        else:
 
1234
            self.extra = ''
 
1235
 
 
1236
 
 
1237
class InvalidImportLine(BzrNewError):
 
1238
    """Not a valid import statement: %(msg)\n%(text)s"""
 
1239
 
 
1240
    is_user_error = False
 
1241
 
 
1242
    def __init__(self, text, msg):
 
1243
        BzrNewError.__init__(self)
 
1244
        self.text = text
 
1245
        self.msg = msg
 
1246
 
 
1247
 
 
1248
class ImportNameCollision(BzrNewError):
 
1249
    """Tried to import an object to the same name as an existing object. %(name)s"""
 
1250
 
 
1251
    is_user_error = False
 
1252
 
 
1253
    def __init__(self, name):
 
1254
        BzrNewError.__init__(self)
 
1255
        self.name = name