qapi: Improve error message for description following section
authorMarkus Armbruster <armbru@redhat.com>
Wed, 10 May 2023 14:16:37 +0000 (16:16 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 22 May 2023 08:03:26 +0000 (10:03 +0200)
The error message is bad when the section is untagged.  For instance,
test case doc-interleaved-section produces "'@foobar:' can't follow
'Note' section", which is okay, but if we drop the "Note:" tag, we get
"'@foobar:' can't follow 'None' section, which is bad.

Change the error message to "description of '@foobar:' follows a
section".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230510141637.3685080-1-armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
[Conflict with commit 3e32dca3f0d resolved]

scripts/qapi/parser.py
tests/qapi-schema/doc-interleaved-section.err

index 1ff334e6a81a0552bf196f8bc79e9beea1a192ca..22e7bcc4b1bcdf35319f2563801e4b584ca63533 100644 (file)
@@ -675,8 +675,8 @@ class QAPIDoc:
         match = self._match_at_name_colon(line)
         if match:
             raise QAPIParseError(self._parser,
-                                 "'@%s:' can't follow '%s' section"
-                                 % (match.group(1), self.sections[0].name))
+                                 "description of '@%s:' follows a section"
+                                 % match.group(1))
         match = self._match_section_tag(line)
         if match:
             line = line[match.end():]
index 715d58cd312d7905cfff32561275f831032d30b7..e5d1ef54c1b4c5da5e8677209513a9cab2c8c9b8 100644 (file)
@@ -1 +1 @@
-doc-interleaved-section.json:15:1: '@foobar:' can't follow 'Note' section
+doc-interleaved-section.json:15:1: description of '@foobar:' follows a section