~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Robert Collins
  • Date: 2010-05-06 23:54:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506235405-wii4elupfhzl3jvy
Add __str__ to the new helper classes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
947
947
    # original exception is available as e.original_error
948
948
    #
949
949
    # New code should prefer to raise specific subclasses
950
 
    def __init__(self, msg):
951
 
        self.msg = msg
 
950
    def __init__(self, message):
 
951
        # Python 2.5 uses a slot for StandardError.message,
 
952
        # so use a different variable name.  We now work around this in
 
953
        # BzrError.__str__, but this member name is kept for compatability.
 
954
        self.msg = message
952
955
 
953
956
 
954
957
class LockActive(LockError):
1038
1041
class LockContention(LockError):
1039
1042
 
1040
1043
    _fmt = 'Could not acquire lock "%(lock)s": %(msg)s'
 
1044
    # TODO: show full url for lock, combining the transport and relative
 
1045
    # bits?
1041
1046
 
1042
1047
    internal_error = False
1043
1048
 
1375
1380
 
1376
1381
class WeaveParentMismatch(WeaveError):
1377
1382
 
1378
 
    _fmt = "Parents are mismatched between two revisions. %(msg)s"
 
1383
    _fmt = "Parents are mismatched between two revisions. %(message)s"
1379
1384
 
1380
1385
 
1381
1386
class WeaveInvalidChecksum(WeaveError):
1382
1387
 
1383
 
    _fmt = "Text did not match it's checksum: %(msg)s"
 
1388
    _fmt = "Text did not match it's checksum: %(message)s"
1384
1389
 
1385
1390
 
1386
1391
class WeaveTextDiffers(WeaveError):
1434
1439
 
1435
1440
class VersionedFileInvalidChecksum(VersionedFileError):
1436
1441
 
1437
 
    _fmt = "Text did not match its checksum: %(msg)s"
 
1442
    _fmt = "Text did not match its checksum: %(message)s"
1438
1443
 
1439
1444
 
1440
1445
class KnitError(InternalBzrError):
1920
1925
    _fmt = "Moving the root directory is not supported at this time"
1921
1926
 
1922
1927
 
1923
 
class TransformRenameFailed(BzrError):
1924
 
 
1925
 
    _fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
1926
 
 
1927
 
    def __init__(self, from_path, to_path, why, errno):
1928
 
        self.from_path = from_path
1929
 
        self.to_path = to_path
1930
 
        self.why = why
1931
 
        self.errno = errno
1932
 
 
1933
 
 
1934
1928
class BzrMoveFailedError(BzrError):
1935
1929
 
1936
1930
    _fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
2845
2839
        BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2846
2840
 
2847
2841
 
2848
 
class ShelvedChanges(UncommittedChanges):
2849
 
 
2850
 
    _fmt = ('Working tree "%(display_url)s" has shelved changes'
2851
 
            ' (See bzr shelve --list).%(more)s')
2852
 
 
2853
 
 
2854
2842
class MissingTemplateVariable(BzrError):
2855
2843
 
2856
2844
    _fmt = 'Variable {%(name)s} is not available.'
3146
3134
    def __init__(self, bzrdir):
3147
3135
        self.bzrdir = bzrdir
3148
3136
 
3149
 
 
3150
 
class NoWhoami(BzrError):
3151
 
 
3152
 
    _fmt = ('Unable to determine your name.\n'
3153
 
        "Please, set your name with the 'whoami' command.\n"
3154
 
        'E.g. bzr whoami "Your Name <name@example.com>"')
3155
 
 
3156
 
 
3157
 
class InvalidPattern(BzrError):
3158
 
 
3159
 
    _fmt = ('Invalid pattern(s) found. %(msg)s')
3160
 
 
3161
 
    def __init__(self, msg):
3162
 
        self.msg = msg
3163
 
 
3164
 
 
3165
 
class RecursiveBind(BzrError):
3166
 
 
3167
 
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
3168
 
        'Please use `bzr unbind` to fix.')
3169
 
 
3170
 
    def __init__(self, branch_url):
3171
 
        self.branch_url = branch_url
3172