qapi: Improve error message for description following section
PATCH 1/1 qapi: Improve error message for description following section
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 <[email protected]>
--- scripts/qapi/parser.py | 4 ++-- tests/qapi-schema/doc-interleaved-section.err | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
scripts/qapi/parser.py +2 -2
@@ -700,8 +700,8 @@ def _append_various_line(self, line: str) -> None: if name.startswith('@') and name.endswith(':'): raise QAPIParseError(self._parser, - "'%s' can't follow '%s' section" - % (name, self.sections[0].name)) + "description of '%s' follows a section" + % name) if self._is_section_tag(name): # If line is "Section: first line of description", find # the index of 'f', which is the indent we expect for any
tests/qapi-schema/doc-interleaved-section.err +1 -1
@@ -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
Signature · 1 line
2.39.2
Quoted 9 lines · Markus Armbruster
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 <[email protected]>
Reviewed-by Juan Quintela <[email protected]>