~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-23 19:08:05 UTC
  • mfrom: (6437.3.20 2.5)
  • mto: This revision was merged to the branch mainline in revision 6450.
  • Revision ID: jelmer@samba.org-20120123190805-hlcuihkt2dep44cw
merge bzr 2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Exceptions for bzr, and reporting of them.
18
18
"""
19
19
 
 
20
from __future__ import absolute_import
 
21
 
20
22
# TODO: is there any value in providing the .args field used by standard
21
23
# python exceptions?   A list of values with no names seems less useful
22
24
# to me.
698
700
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
699
701
 
700
702
 
 
703
class AlreadyControlDirError(PathError):
 
704
 
 
705
    _fmt = 'A control directory already exists: "%(path)s".'
 
706
 
 
707
 
701
708
class AlreadyBranchError(PathError):
702
709
 
703
710
    _fmt = 'Already a branch: "%(path)s".'
761
768
        self.bzrdir = bzrdir_format
762
769
 
763
770
 
 
771
class ParseFormatError(BzrError):
 
772
 
 
773
    _fmt = "Parse error on line %(lineno)d of %(format)s format: %(line)s"
 
774
 
 
775
    def __init__(self, format, lineno, line, text):
 
776
        BzrError.__init__(self)
 
777
        self.format = format
 
778
        self.lineno = lineno
 
779
        self.line = line
 
780
        self.text = text
 
781
 
 
782
 
764
783
class IncompatibleRepositories(BzrError):
765
784
    """Report an error that two repositories are not compatible.
766
785
 
1653
1672
        TransportError.__init__(self, msg, orig_error=orig_error)
1654
1673
 
1655
1674
 
 
1675
class CertificateError(TransportError):
 
1676
 
 
1677
    _fmt = "Certificate error: %(error)s"
 
1678
 
 
1679
    def __init__(self, error):
 
1680
        self.error = error
 
1681
 
 
1682
 
1656
1683
class InvalidHttpRange(InvalidHttpResponse):
1657
1684
 
1658
1685
    _fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
3240
3267
        self.format = format
3241
3268
 
3242
3269
 
 
3270
class MissingFeature(BzrError):
 
3271
 
 
3272
    _fmt = ("Missing feature %(feature)s not provided by this "
 
3273
            "version of Bazaar or any plugin.")
 
3274
 
 
3275
    def __init__(self, feature):
 
3276
        self.feature = feature
 
3277
 
 
3278
 
3243
3279
class PatchSyntax(BzrError):
3244
3280
    """Base class for patch syntax errors."""
3245
3281
 
3289
3325
        self.line_no = line_no
3290
3326
        self.orig_line = orig_line.rstrip('\n')
3291
3327
        self.patch_line = patch_line.rstrip('\n')
 
3328
 
 
3329
 
 
3330
class FeatureAlreadyRegistered(BzrError):
 
3331
 
 
3332
    _fmt = 'The feature %(feature)s has already been registered.'
 
3333
 
 
3334
    def __init__(self, feature):
 
3335
        self.feature = feature