Rev 2436: Add an explicit error for missing help topics. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Fri Apr 20 01:14:17 BST 2007


At file:///home/robertc/source/baz/help-contexts/

------------------------------------------------------------
revno: 2436
revision-id: robertc at robertcollins.net-20070420001415-iequi10ao2s4jtu4
parent: robertc at robertcollins.net-20070420000646-nwrkgumqaykrg1lz
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 10:14:15 +1000
message:
  Add an explicit error for missing help topics.
modified:
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2007-04-13 05:06:23 +0000
+++ b/bzrlib/errors.py	2007-04-20 00:14:15 +0000
@@ -223,6 +223,16 @@
     def __init__(self, revision_id):
         self.revision_id = revision_id
 
+
+class NoHelpTopic(BzrError):
+
+    _fmt = ("No help could be found for '%(topic)s'. "
+        "Please use 'bzr help topics' to obtain a list of topics.")
+
+    def __init__(self, topic):
+        self.topic = topic
+
+
 class NoSuchId(BzrError):
 
     _fmt = "The file id %(file_id)s is not present in the tree %(tree)s."

=== modified file 'bzrlib/tests/test_errors.py'
--- a/bzrlib/tests/test_errors.py	2007-04-10 14:12:35 +0000
+++ b/bzrlib/tests/test_errors.py	2007-04-20 00:14:15 +0000
@@ -91,6 +91,12 @@
             "smart protocol.",
             str(error))
 
+    def test_no_help_topic(self):
+        error = errors.NoHelpTopic("topic")
+        self.assertEqualDiff("No help could be found for 'topic'. "
+            "Please use 'bzr help topics' to obtain a list of topics.",
+            str(error))
+
     def test_no_such_id(self):
         error = errors.NoSuchId("atree", "anid")
         self.assertEqualDiff("The file id anid is not present in the tree "



More information about the bazaar-commits mailing list