~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Brian de Alwis
  • Date: 2009-10-14 20:08:57 UTC
  • mto: This revision was merged to the branch mainline in revision 4965.
  • Revision ID: bsd@acm.org-20091014200857-jyeb6jkq3sh5rz5p
Add a 'detail' field to NotBranchError to hold additional helpful
information for the user in diagnosing problems.  The 'detail' field
is kept separate from the 'extra' field as the 'extra' field is a
string oriented for formatted display, and may not actually correspond
to the 'detail' value.

Show diffs side-by-side

added added

removed removed

Lines of Context:
702
702
# TODO: Probably this behavior of should be a common superclass
703
703
class NotBranchError(PathError):
704
704
 
705
 
    _fmt = 'Not a branch: "%(path)s".'
 
705
    _fmt = 'Not a branch: "%(path)s"%(extra)s.'
706
706
 
707
 
    def __init__(self, path):
 
707
    def __init__(self, path, detail=None):
708
708
       import bzrlib.urlutils as urlutils
709
 
       self.path = urlutils.unescape_for_display(path, 'ascii')
 
709
       path = urlutils.unescape_for_display(path, 'ascii')
 
710
       # remember the detail in case of remote serialization
 
711
       self.detail = detail
 
712
       PathError.__init__(self, path=path, extra=self.detail)
710
713
 
711
714
 
712
715
class NoSubmitBranch(PathError):