~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-18 13:02:52 UTC
  • mfrom: (5830.3.6 i18n-msgfmt)
  • Revision ID: pqm@pqm.ubuntu.com-20110518130252-ky96qcvzt6o0zg3f
(mbp) add build_mo command to setup.py (INADA Naoki)

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
    Base class for errors raised by bzrlib.
55
55
 
56
56
    :cvar internal_error: if True this was probably caused by a bzr bug and
57
 
        should be displayed with a traceback; if False (or absent) this was
58
 
        probably a user or environment error and they don't need the gory
59
 
        details.  (That can be overridden by -Derror on the command line.)
 
57
    should be displayed with a traceback; if False (or absent) this was
 
58
    probably a user or environment error and they don't need the gory details.
 
59
    (That can be overridden by -Derror on the command line.)
60
60
 
61
61
    :cvar _fmt: Format string to display the error; this is expanded
62
 
        by the instance's dict.
 
62
    by the instance's dict.
63
63
    """
64
64
 
65
65
    internal_error = False
304
304
class RootMissing(InternalBzrError):
305
305
 
306
306
    _fmt = ("The root entry of a tree must be the first entry supplied to "
307
 
        "the commit builder.")
 
307
        "record_entry_contents.")
308
308
 
309
309
 
310
310
class NoPublicBranch(BzrError):
864
864
        """Construct a new AlreadyVersionedError.
865
865
 
866
866
        :param path: This is the path which is versioned,
867
 
            which should be in a user friendly form.
 
867
        which should be in a user friendly form.
868
868
        :param context_info: If given, this is information about the context,
869
 
            which could explain why this is expected to not be versioned.
 
869
        which could explain why this is expected to not be versioned.
870
870
        """
871
871
        BzrError.__init__(self)
872
872
        self.path = path
885
885
        """Construct a new NotVersionedError.
886
886
 
887
887
        :param path: This is the path which is not versioned,
888
 
            which should be in a user friendly form.
 
888
        which should be in a user friendly form.
889
889
        :param context_info: If given, this is information about the context,
890
 
            which could explain why this is expected to be versioned.
 
890
        which could explain why this is expected to be versioned.
891
891
        """
892
892
        BzrError.__init__(self)
893
893
        self.path = path
1715
1715
 
1716
1716
class InvalidHttpResponse(TransportError):
1717
1717
 
1718
 
    _fmt = "Invalid http response for %(path)s: %(msg)s%(orig_error)s"
 
1718
    _fmt = "Invalid http response for %(path)s: %(msg)s"
1719
1719
 
1720
1720
    def __init__(self, path, msg, orig_error=None):
1721
1721
        self.path = path
1722
 
        if orig_error is None:
1723
 
            orig_error = ''
1724
 
        else:
1725
 
            # This is reached for obscure and unusual errors so we want to
1726
 
            # preserve as much info as possible to ease debug.
1727
 
            orig_error = ': %r' % (orig_error,)
1728
1722
        TransportError.__init__(self, msg, orig_error=orig_error)
1729
1723
 
1730
1724
 
1770
1764
    _fmt = "Working tree has conflicts."
1771
1765
 
1772
1766
 
1773
 
class ConfigContentError(BzrError):
1774
 
 
1775
 
    _fmt = "Config file %(filename)s is not UTF-8 encoded\n"
1776
 
 
1777
 
    def __init__(self, filename):
1778
 
        BzrError.__init__(self)
1779
 
        self.filename = filename
1780
 
 
1781
 
 
1782
1767
class ParseConfigError(BzrError):
1783
1768
 
1784
1769
    _fmt = "Error(s) parsing config file %(filename)s:\n%(errors)s"
1800
1785
 
1801
1786
class SigningFailed(BzrError):
1802
1787
 
1803
 
    _fmt = 'Failed to GPG sign data with command "%(command_line)s"'
 
1788
    _fmt = 'Failed to gpg sign data with command "%(command_line)s"'
1804
1789
 
1805
1790
    def __init__(self, command_line):
1806
1791
        BzrError.__init__(self, command_line=command_line)
1807
1792
 
1808
1793
 
1809
 
class SignatureVerificationFailed(BzrError):
1810
 
 
1811
 
    _fmt = 'Failed to verify GPG signature data with error "%(error)s"'
1812
 
 
1813
 
    def __init__(self, error):
1814
 
        BzrError.__init__(self, error=error)
1815
 
 
1816
 
 
1817
 
class DependencyNotPresent(BzrError):
1818
 
 
1819
 
    _fmt = 'Unable to import library "%(library)s": %(error)s'
1820
 
 
1821
 
    def __init__(self, library, error):
1822
 
        BzrError.__init__(self, library=library, error=error)
1823
 
 
1824
 
 
1825
 
class GpgmeNotInstalled(DependencyNotPresent):
1826
 
 
1827
 
    _fmt = 'python-gpgme is not installed, it is needed to verify signatures'
1828
 
 
1829
 
    def __init__(self, error):
1830
 
        DependencyNotPresent.__init__(self, 'gpgme', error)
1831
 
 
1832
 
 
1833
1794
class WorkingTreeNotRevision(BzrError):
1834
1795
 
1835
1796
    _fmt = ("The working tree for %(basedir)s has changed since"
2088
2049
    _fmt = "Parameter %(param)s contains a newline."
2089
2050
 
2090
2051
 
 
2052
class DependencyNotPresent(BzrError):
 
2053
 
 
2054
    _fmt = 'Unable to import library "%(library)s": %(error)s'
 
2055
 
 
2056
    def __init__(self, library, error):
 
2057
        BzrError.__init__(self, library=library, error=error)
 
2058
 
 
2059
 
2091
2060
class ParamikoNotPresent(DependencyNotPresent):
2092
2061
 
2093
2062
    _fmt = "Unable to import paramiko (required for sftp support): %(error)s"
2696
2665
 
2697
2666
    This is distinct from ErrorFromSmartServer so that it is possible to
2698
2667
    distinguish between the following two cases:
2699
 
 
2700
 
    - ErrorFromSmartServer was uncaught.  This is logic error in the client
2701
 
      and so should provoke a traceback to the user.
2702
 
    - ErrorFromSmartServer was caught but its error_tuple could not be
2703
 
      translated.  This is probably because the server sent us garbage, and
2704
 
      should not provoke a traceback.
 
2668
      - ErrorFromSmartServer was uncaught.  This is logic error in the client
 
2669
        and so should provoke a traceback to the user.
 
2670
      - ErrorFromSmartServer was caught but its error_tuple could not be
 
2671
        translated.  This is probably because the server sent us garbage, and
 
2672
        should not provoke a traceback.
2705
2673
    """
2706
2674
 
2707
2675
    _fmt = "Server sent an unexpected error: %(error_tuple)r"
3106
3074
    _fmt = "Shelf corrupt."
3107
3075
 
3108
3076
 
3109
 
class DecompressCorruption(BzrError):
3110
 
 
3111
 
    _fmt = "Corruption while decompressing repository file%(orig_error)s"
3112
 
 
3113
 
    def __init__(self, orig_error=None):
3114
 
        if orig_error is not None:
3115
 
            self.orig_error = ", %s" % (orig_error,)
3116
 
        else:
3117
 
            self.orig_error = ""
3118
 
        BzrError.__init__(self)
3119
 
 
3120
 
 
3121
3077
class NoSuchShelfId(BzrError):
3122
3078
 
3123
3079
    _fmt = 'No changes are shelved with id "%(shelf_id)d".'