~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Andrew Bennetts
  • Date: 2010-09-06 06:13:52 UTC
  • mto: (4634.158.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5419.
  • Revision ID: andrew.bennetts@canonical.com-20100906061352-ef2rw40pa5wte5oj
Add LockCorrupt error, and use it to provide nicer handling of unparseable lock/held/info files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1054
1054
        self.target = target
1055
1055
 
1056
1056
 
 
1057
class LockCorrupt(LockError):
 
1058
 
 
1059
    _fmt = ("Lock is apparently held, but corrupted: %(corruption_info)s\n"
 
1060
            "Use 'bzr break-lock' to clear it")
 
1061
 
 
1062
    internal_error = False
 
1063
 
 
1064
    def __init__(self, corruption_info, file_data=None):
 
1065
        self.corruption_info = corruption_info
 
1066
        self.file_data = file_data
 
1067
 
 
1068
 
1057
1069
class LockNotHeld(LockError):
1058
1070
 
1059
1071
    _fmt = "Lock not held: %(lock)s"