144
class NotLocalUrl(BzrNewError):
145
"""%s(url) is not a local path."""
147
def __init__(self, url):
148
BzrNewError.__init__(self)
141
152
class BzrCommandError(BzrError):
142
153
# Error from malformed user command
143
154
# This is being misused as a generic exception
144
155
# pleae subclass. RBC 20051030
157
# I think it's a waste of effort to differentiate between errors that
158
# are not intended to be caught anyway. UI code need not subclass
159
# BzrCommandError, and non-UI code should not throw a subclass of
160
# BzrCommandError. ADHB 20051211
145
161
def __str__(self):
146
162
return self.args[0]
153
169
class StrictCommitFailed(Exception):
154
170
"""Commit refused because there are unknowns in the tree."""
173
class PathError(BzrNewError):
174
"""Generic path error: %(path)r%(extra)s)"""
175
def __init__(self, path, extra=None):
176
BzrNewError.__init__(self)
179
self.extra = ': ' + str(extra)
184
class NoSuchFile(PathError):
185
"""No such file: %(path)r%(extra)s"""
188
class FileExists(PathError):
189
"""File exists: %(path)r%(extra)s"""
192
class PermissionDenied(PathError):
193
"""Permission denied: %(path)r%(extra)s"""
196
class PathNotChild(BzrNewError):
197
"""Path %(path)r is not a child of path %(base)r%(extra)s"""
198
def __init__(self, path, base, extra=None):
199
BzrNewError.__init__(self)
203
self.extra = ': ' + str(extra)
156
208
class NotBranchError(BzrNewError):
157
209
"""Not a branch: %(path)s"""
158
210
def __init__(self, path):
172
232
class UnsupportedFormatError(BzrError):
173
"""Specified path is a bzr branch that we cannot read."""
233
"""Specified path is a bzr branch that we recognize but cannot read."""
174
234
def __str__(self):
175
235
return 'unsupported branch format: %s' % self.args[0]
238
class UnknownFormatError(BzrError):
239
"""Specified path is a bzr branch whose format we do not recognize."""
241
return 'unknown branch format: %s' % self.args[0]
244
class IncompatibleFormat(BzrNewError):
245
"""Format %(format)s is not compatible with .bzr version %(bzrdir)s."""
247
def __init__(self, format, bzrdir_format):
248
BzrNewError.__init__(self)
250
self.bzrdir = bzrdir_format
178
253
class NotVersionedError(BzrNewError):
179
254
"""%(path)s is not versioned"""
180
255
def __init__(self, path):
247
328
BzrCommandError.__init__(self, msg)
249
331
class NoCommonAncestor(BzrError):
250
332
def __init__(self, revision_a, revision_b):
251
333
msg = "Revisions have no common ancestor: %s %s." \
252
334
% (revision_a, revision_b)
253
335
BzrError.__init__(self, msg)
255
338
class NoCommonRoot(BzrError):
256
339
def __init__(self, revision_a, revision_b):
257
340
msg = "Revisions are not derived from the same root: %s %s." \
258
341
% (revision_a, revision_b)
259
342
BzrError.__init__(self, msg)
261
class NotAncestor(BzrError):
262
def __init__(self, rev_id, not_ancestor_id):
263
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
265
BzrError.__init__(self, msg)
267
self.not_ancestor_id = not_ancestor_id
270
class NotAncestor(BzrError):
271
def __init__(self, rev_id, not_ancestor_id):
273
self.not_ancestor_id = not_ancestor_id
274
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
276
BzrError.__init__(self, msg)
345
class NotAncestor(BzrError):
346
def __init__(self, rev_id, not_ancestor_id):
347
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
349
BzrError.__init__(self, msg)
351
self.not_ancestor_id = not_ancestor_id
279
354
class InstallFailed(BzrError):
290
365
BzrError.__init__(self, msg)
291
366
self.bases = bases
293
369
class NoCommits(BzrError):
294
370
def __init__(self, branch):
295
371
msg = "Branch %s has no commits." % branch
296
372
BzrError.__init__(self, msg)
298
375
class UnlistableStore(BzrError):
299
376
def __init__(self, store):
300
377
BzrError.__init__(self, "Store %s is not listable" % store)
302
380
class UnlistableBranch(BzrError):
303
381
def __init__(self, br):
304
382
BzrError.__init__(self, "Stores for branch %s are not listable" % br)
338
416
"""Parents are mismatched between two revisions."""
419
class WeaveInvalidChecksum(WeaveError):
420
"""Text did not match it's checksum: %(message)s"""
423
class WeaveTextDiffers(WeaveError):
424
"""Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"""
426
def __init__(self, revision_id, weave_a, weave_b):
427
WeaveError.__init__(self)
428
self.revision_id = revision_id
429
self.weave_a = weave_a
430
self.weave_b = weave_b
433
class NoSuchExportFormat(BzrNewError):
434
"""Export format %(format)r not supported"""
435
def __init__(self, format):
436
BzrNewError.__init__(self)
341
440
class TransportError(BzrError):
342
441
"""All errors thrown by Transport implementations should derive
359
class NonRelativePath(TransportError):
360
"""An absolute path was supplied, that could not be decoded into
365
class NoSuchFile(TransportError, IOError):
366
"""A get() was issued for a file that doesn't exist."""
368
# XXX: Is multiple inheritance for exceptions really needed?
371
return 'no such file: ' + self.msg
373
def __init__(self, msg=None, orig_error=None):
375
TransportError.__init__(self, msg=msg, orig_error=orig_error)
376
IOError.__init__(self, errno.ENOENT, self.msg)
378
class ConnectionError(TransportError, IOError):
380
A connection problem prevents file retrieval.
460
class ConnectionError(TransportError):
461
"""A connection problem prevents file retrieval.
381
462
This does not indicate whether the file exists or not; it indicates that a
382
463
precondition for requesting the file was not met.
385
# XXX: Is multiple inheritance for exceptions really needed?
388
return 'connection error: ' + self.msg
390
def __init__(self, msg=None, orig_error=None):
392
TransportError.__init__(self, msg=msg, orig_error=orig_error)
393
IOError.__init__(self, errno.ENOENT, self.msg)
396
class FileExists(TransportError, OSError):
397
"""An operation was attempted, which would overwrite an entry,
398
but overwritting is not supported.
400
mkdir() can throw this, but put() just overwites existing files.
402
# XXX: Is multiple inheritance for exceptions really needed?
403
def __init__(self, msg=None, orig_error=None):
405
TransportError.__init__(self, msg=msg, orig_error=orig_error)
406
OSError.__init__(self, errno.EEXIST, self.msg)
408
class PermissionDenied(TransportError):
409
"""An operation cannot succeed because of a lack of permissions."""
465
def __init__(self, msg=None, orig_error=None):
466
TransportError.__init__(self, msg=msg, orig_error=orig_error)
412
469
class ConnectionReset(TransportError):
413
470
"""The connection has been closed."""
416
474
class ConflictsInTree(BzrError):
417
475
def __init__(self):
418
476
BzrError.__init__(self, "Working tree has conflicts.")
420
479
class ParseConfigError(BzrError):
421
480
def __init__(self, errors, filename):
422
481
if filename is None:
425
484
(filename, ('\n'.join(e.message for e in errors)))
426
485
BzrError.__init__(self, message)
428
488
class SigningFailed(BzrError):
429
489
def __init__(self, command_line):
430
490
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
433
494
class WorkingTreeNotRevision(BzrError):
434
495
def __init__(self, tree):
435
496
BzrError.__init__(self, "The working tree for %s has changed since"
436
497
" last commit, but weave merge requires that it be"
437
498
" unchanged." % tree.basedir)
439
501
class CantReprocessAndShowBase(BzrNewError):
440
502
"""Can't reprocess and show base.
441
503
Reprocessing obscures relationship of conflicting lines to base."""
443
506
class GraphCycleError(BzrNewError):
444
507
"""Cycle in graph %(graph)r"""
445
508
def __init__(self, graph):
446
509
BzrNewError.__init__(self)
447
510
self.graph = graph
449
513
class NotConflicted(BzrNewError):
450
514
"""File %(filename)s is not conflicted."""
451
516
def __init__(self, filename):
452
517
BzrNewError.__init__(self)
453
518
self.filename = filename
455
521
class MustUseDecorated(Exception):
456
522
"""A decorating function has requested its original command be used.
458
524
This should never escape bzr, so does not need to be printable.
461
528
class MissingText(BzrNewError):
462
529
"""Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"""
463
531
def __init__(self, branch, text_revision, file_id):
532
BzrNewError.__init__(self)
464
533
self.branch = branch
465
534
self.base = branch.base
466
535
self.text_revision = text_revision
467
536
self.file_id = file_id
539
class BzrBadParameter(BzrNewError):
540
"""A bad parameter : %(param)s is not usable.
542
This exception should never be thrown, but it is a base class for all
543
parameter-to-function errors.
545
def __init__(self, param):
546
BzrNewError.__init__(self)
550
class BzrBadParameterNotUnicode(BzrBadParameter):
551
"""Parameter %(param)s is neither unicode nor utf8."""
554
class BzrBadParameterNotString(BzrBadParameter):
555
"""Parameter %(param)s is not a string or unicode string."""
558
class BzrBadParameterMissing(BzrBadParameter):
559
"""Parameter $(param)s is required but not present."""
562
class DependencyNotPresent(BzrNewError):
563
"""Unable to import library: %(library)s, %(error)s"""
565
def __init__(self, library, error):
566
BzrNewError.__init__(self, library=library, error=error)
569
class ParamikoNotPresent(DependencyNotPresent):
570
"""Unable to import paramiko (required for sftp support): %(error)s"""
572
def __init__(self, error):
573
DependencyNotPresent.__init__(self, 'paramiko', error)
576
class UninitializableFormat(BzrNewError):
577
"""Format %(format)s cannot be initialised by this version of bzr."""
579
def __init__(self, format):
580
BzrNewError.__init__(self)
584
class OutOfDateTree(BzrNewError):
585
"""Working tree is out of date, please run 'bzr update'."""
587
def __init__(self, tree):
588
BzrNewError.__init__(self)