~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Jelmer Vernooij
  • Date: 2010-08-17 22:24:01 UTC
  • mfrom: (5379 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5389.
  • Revision ID: jelmer@samba.org-20100817222401-x6iblsx36pu6bi3r
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
949
949
    # original exception is available as e.original_error
950
950
    #
951
951
    # New code should prefer to raise specific subclasses
952
 
    def __init__(self, message):
953
 
        # Python 2.5 uses a slot for StandardError.message,
954
 
        # so use a different variable name.  We now work around this in
955
 
        # BzrError.__str__, but this member name is kept for compatability.
956
 
        self.msg = message
 
952
    def __init__(self, msg):
 
953
        self.msg = msg
957
954
 
958
955
 
959
956
class LockActive(LockError):
1381
1378
 
1382
1379
class WeaveParentMismatch(WeaveError):
1383
1380
 
1384
 
    _fmt = "Parents are mismatched between two revisions. %(message)s"
 
1381
    _fmt = "Parents are mismatched between two revisions. %(msg)s"
1385
1382
 
1386
1383
 
1387
1384
class WeaveInvalidChecksum(WeaveError):
1388
1385
 
1389
 
    _fmt = "Text did not match it's checksum: %(message)s"
 
1386
    _fmt = "Text did not match it's checksum: %(msg)s"
1390
1387
 
1391
1388
 
1392
1389
class WeaveTextDiffers(WeaveError):
1440
1437
 
1441
1438
class VersionedFileInvalidChecksum(VersionedFileError):
1442
1439
 
1443
 
    _fmt = "Text did not match its checksum: %(message)s"
 
1440
    _fmt = "Text did not match its checksum: %(msg)s"
1444
1441
 
1445
1442
 
1446
1443
class KnitError(InternalBzrError):
2846
2843
        else:
2847
2844
            more = ' ' + more
2848
2845
        import bzrlib.urlutils as urlutils
2849
 
        display_url = urlutils.unescape_for_display(
2850
 
            tree.user_url, 'ascii')
 
2846
        user_url = getattr(tree, "user_url", None)
 
2847
        if user_url is None:
 
2848
            display_url = str(tree)
 
2849
        else:
 
2850
            display_url = urlutils.unescape_for_display(user_url, 'ascii')
2851
2851
        BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2852
2852
 
2853
2853
 
3152
3152
    def __init__(self, bzrdir):
3153
3153
        self.bzrdir = bzrdir
3154
3154
 
 
3155
 
3155
3156
class NoWhoami(BzrError):
3156
3157
 
3157
3158
    _fmt = ('Unable to determine your name.\n'
3158
3159
        "Please, set your name with the 'whoami' command.\n"
3159
3160
        'E.g. bzr whoami "Your Name <name@example.com>"')
3160
3161
 
 
3162
 
3161
3163
class InvalidPattern(BzrError):
3162
3164
 
3163
3165
    _fmt = ('Invalid pattern(s) found. %(msg)s')
3165
3167
    def __init__(self, msg):
3166
3168
        self.msg = msg
3167
3169
 
 
3170
 
 
3171
class RecursiveBind(BzrError):
 
3172
 
 
3173
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
 
3174
        'Please use `bzr unbind` to fix.')
 
3175
 
 
3176
    def __init__(self, branch_url):
 
3177
        self.branch_url = branch_url
 
3178