Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 <armbru@redhat.com>
Message-Id: <20230510141637.3685080-1-armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
[Conflict with commit 3e32dca resolved]
  • Loading branch information
Markus Armbruster committed May 22, 2023
1 parent aa222a8 commit 290e48e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/qapi/parser.py
Expand Up @@ -675,8 +675,8 @@ def _append_various_line(self, line: str) -> None:
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():]
Expand Down
2 changes: 1 addition & 1 deletion tests/qapi-schema/doc-interleaved-section.err
@@ -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

0 comments on commit 290e48e

Please sign in to comment.