# exceptions that don't provide their own message?
120
120
# base classes should override the docstring with their human-
121
121
# readable explanation
122
122
123
def __init__(self, **kwds):
123
def __init__(self, *args, **kwds):
124
# XXX: Use the underlying BzrError to always generate the args attribute
125
# if it doesn't exist. We can't use super here, because exceptions are
126
# old-style classes in python2.4 (but new in 2.5). --bmc, 20060426
127
BzrError.__init__(self, *args)
124
128
for key, value in kwds.items():
125
129
setattr(self, key, value)
126
130
179
183
self.branch = branch
180
184
181
185
186
class InventoryModified(BzrNewError):
187
"""The current inventory for the tree %(tree)r has been modified, so a clean inventory cannot be read without data loss."""
188
189
def __init__(self, tree):
190
BzrNewError.__init__(self)
191
self.tree = tree
192
193
182
194
class NoSuchId(BzrNewError):
183
195
"""The file id %(file_id)s is not present in the tree %(tree)s."""
184
196
208
220
self.url = url
209
221
210
222
223
class NotWriteLocked(BzrNewError):
224
"""%(not_locked)r is not write locked but needs to be."""
225
226
def __init__(self, not_locked):
227
BzrNewError.__init__(self)
228
self.not_locked = not_locked
229
230
211
231
class BzrCommandError(BzrNewError):
212
232
"""Error from user command"""
213
233
266
286
"""Directory not empty: %(path)r%(extra)s"""
267
287
268
288
289
class ReadingCompleted(BzrNewError):
290
"""The MediumRequest '%(request)s' has already had finish_reading called upon it - the request has been completed and no more data may be read."""
291
292
is_user_error = False
293
294
def __init__(self, request):
295
BzrNewError.__init__(self)
296
self.request = request
297
298
269
299
class ResourceBusy(PathError):
270
300
"""Device or resource busy: %(path)r%(extra)s"""
271
301
283
313
284
314
def __init__(self, msg, base, args):
285
315
PathError.__init__(self, base, msg)
286
self.args = [base]
287
self.args.extend(args)
316
self.args = [base] + list(args)
288
317
289
318
290
319
class UnsupportedProtocol(PathError):
395
424
self.bzrdir = bzrdir_format
396
425
397
426
427
class IncompatibleRevision(BzrNewError):
428
"""Revision is not compatible with %(repo_format)s"""
429
430
def __init__(self, repo_format):
431
BzrNewError.__init__(self)
432
self.repo_format = repo_format
433
434
398
435
class NotVersionedError(BzrNewError):
399
436
"""%(path)s is not versioned"""
400
437
def __init__(self, path):
791
828
792
829
class NoSuchExportFormat(BzrNewError):
793
830
"""Export format %(format)r not supported"""
831
794
832
def __init__(self, format):
795
833
BzrNewError.__init__(self)
796
834
self.format = format
797
835
798
836
837
838
class TooManyConcurrentRequests(BzrNewError):
839
"""The medium '%(medium)s' has reached its concurrent request limit. Be sure to finish_writing and finish_reading on the current request that is open."""
840
841
def __init__(self, medium):
842
BzrNewError.__init__(self)
843
self.medium = medium
844
845
799
846
class TransportError(BzrNewError):
800
847
"""Transport error: %(msg)s %(orig_error)s"""
801
848
820
867
821
868
# A set of semi-meaningful errors which can be thrown
822
869
class TransportNotPossible(TransportError):
823
"""Transport operation not possible: %(msg)s %(orig_error)%"""
870
"""Transport operation not possible: %(msg)s %(orig_error)s"""
824
871
825
872
826
873
class ConnectionError(TransportError):
879
926
BzrError.__init__(self, message)
880
927
881
928
929
class NoEmailInUsername(BzrNewError):
930
"""%(username)r does not seem to contain a reasonable email address"""
931
932
def __init__(self, username):
933
BzrNewError.__init__(self)
934
self.username = username
935
936
882
937
class SigningFailed(BzrError):
883
938
def __init__(self, command_line):
884
939
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
892
947
" unchanged." % tree.basedir)
893
948
894
949
950
class WritingCompleted(BzrNewError):
951
"""The MediumRequest '%(request)s' has already had finish_writing called upon it - accept bytes may not be called anymore."""
952
953
is_user_error = False
954
955
def __init__(self, request):
956
BzrNewError.__init__(self)
957
self.request = request
958
959
960
class WritingNotComplete(BzrNewError):
961
"""The MediumRequest '%(request)s' has not has finish_writing called upon it - until the write phase is complete no data may be read."""
962
963
is_user_error = False
964
965
def __init__(self, request):
966
BzrNewError.__init__(self)
967
self.request = request
968
969
895
970
class CantReprocessAndShowBase(BzrNewError):
896
971
"""Can't reprocess and show base.
897
972
Reprocessing obscures relationship of conflicting lines to base."""
912
987
self.filename = filename
913
988
914
989
990
class MediumNotConnected(BzrNewError):
991
"""The medium '%(medium)s' is not connected."""
992
993
def __init__(self, medium):
994
BzrNewError.__init__(self)
995
self.medium = medium
996
997
915
998
class MustUseDecorated(Exception):
916
999
"""A decorating function has requested its original command be used.
917
1000
953
1036
"""Tree transform is malformed %(conflicts)r"""
954
1037
955
1038
1039
class NoFinalPath(BzrNewError):
1040
"""No final name for trans_id %(trans_id)r
1041
file-id: %(file_id)r"
1042
root trans-id: %(root_trans_id)r
1043
"""
1044
1045
def __init__(self, trans_id, transform):
1046
self.trans_id = trans_id
1047
self.file_id = transform.final_file_id(trans_id)
1048
self.root_trans_id = transform.root
1049
1050
956
1051
class BzrBadParameter(BzrNewError):
957
1052
"""A bad parameter : %(param)s is not usable.
958
1053
1185
1280
BzrNewError.__init__(self)
1186
1281
1187
1282
1283
class IncompatibleFormat(BzrNewError):
1284
"""Bundle format %(bundle_format)s is incompatible with %(other)s"""
1285
1286
def __init__(self, bundle_format, other):
1287
BzrNewError.__init__(self)
1288
self.bundle_format = bundle_format
1289
self.other = other
1290
1291
1188
1292
class BadInventoryFormat(BzrNewError):
1189
1293
"""Root class for inventory serialization errors"""
1190
1294
1196
1300
BadInventoryFormat.__init__(self, msg=msg)
1197
1301
1198
1302
1303
class NoSmartMedium(BzrNewError):
1304
"""The transport '%(transport)s' cannot tunnel the smart protocol."""