187
187
class BzrCommandError(BzrNewError):
188
188
"""Error from user command"""
189
190
is_user_error = True
190
# Error from malformed user command
191
# This is being misused as a generic exception
192
# pleae subclass. RBC 20051030
192
# Error from malformed user command; please avoid raising this as a
193
# generic exception not caused by user input.
194
195
# I think it's a waste of effort to differentiate between errors that
195
196
# are not intended to be caught anyway. UI code need not subclass
206
class BzrOptionError(BzrCommandError):
207
"""Error in command line options"""
205
210
class StrictCommitFailed(BzrNewError):
206
"""Commit refused because there are unknowns in the tree."""
211
"""Commit refused because there are unknown files in the tree"""
209
214
# XXX: Should be unified with TransportError; they seem to represent the
223
228
class NoSuchFile(PathError):
224
"""No such file: %(path)s%(extra)s"""
229
"""No such file: %(path)r%(extra)s"""
227
232
class FileExists(PathError):
228
"""File exists: %(path)s%(extra)s"""
233
"""File exists: %(path)r%(extra)s"""
231
236
class DirectoryNotEmpty(PathError):
232
"""Directory not empty: %(path)s%(extra)s"""
237
"""Directory not empty: %(path)r%(extra)s"""
235
240
class ResourceBusy(PathError):
236
"""Device or resource busy: %(path)s%(extra)s"""
241
"""Device or resource busy: %(path)r%(extra)s"""
239
244
class PermissionDenied(PathError):
240
"""Permission denied: %(path)s%(extra)s"""
245
"""Permission denied: %(path)r%(extra)s"""
248
class InvalidURL(PathError):
249
"""Invalid url supplied to transport: %(path)r%(extra)s"""
252
class InvalidURLJoin(PathError):
253
"""Invalid URL join request: %(args)s%(extra)s"""
255
def __init__(self, msg, base, args):
256
PathError.__init__(self, base, msg)
258
self.args.extend(args)
243
261
class PathNotChild(BzrNewError):
244
"""Path %(path)s is not a child of path %(base)s%(extra)s"""
262
"""Path %(path)r is not a child of path %(base)r%(extra)s"""
246
264
is_user_error = False
276
# TODO: This is given a URL; we try to unescape it but doing that from inside
277
# the exception object is a bit undesirable.
278
# TODO: Probably this behavior of should be a common superclass
258
279
class NotBranchError(PathError):
259
280
"""Not a branch: %(path)s"""
271
292
class NoRepositoryPresent(BzrNewError):
272
"""No repository present: %(path)s"""
293
"""No repository present: %(path)r"""
273
294
def __init__(self, bzrdir):
274
295
BzrNewError.__init__(self)
275
296
self.path = bzrdir.transport.clone('..').base
380
401
class ObjectNotLocked(LockError):
381
"""%(obj)s is not locked"""
402
"""%(obj)r is not locked"""
382
404
is_user_error = False
383
406
# this can indicate that any particular object is not locked; see also
384
407
# LockNotHeld which means that a particular *lock* object is not held by
385
408
# the caller -- perhaps they should be unified.
415
438
class LockBreakMismatch(LockError):
416
"""Lock was released and re-acquired before being broken: %(lock)s: held by %(holder)s, wanted to break %(target)r"""
439
"""Lock was released and re-acquired before being broken: %(lock)s: held by %(holder)r, wanted to break %(target)r"""
417
440
def __init__(self, lock, holder, target):
419
442
self.holder = holder
509
532
def __init__(self, bases):
510
533
warn("BzrError AmbiguousBase has been deprecated as of bzrlib 0.8.",
511
534
DeprecationWarning)
512
msg = "The correct base is unclear, becase %s are all equally close" %\
535
msg = "The correct base is unclear, because %s are all equally close" %\
514
537
BzrError.__init__(self, msg)
515
538
self.bases = bases
860
883
self.format = format
886
class NoDiff(BzrNewError):
887
"""Diff is not installed on this machine: %(msg)s"""
889
def __init__(self, msg):
890
super(NoDiff, self).__init__(msg=msg)
863
893
class NoDiff3(BzrNewError):
864
894
"""Diff3 is not installed on this machine."""
956
986
self.measured = measured
989
class NotABundle(BzrNewError):
990
"""Not a bzr revision-bundle: %(text)r"""
992
def __init__(self, text):
959
996
class BadBundle(Exception): pass