diff options
author | Markus Armbruster <armbru@redhat.com> | 2024-02-16 15:58:29 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2024-02-26 10:43:56 +0100 |
commit | 15333abed9112f99e0b1af4327154af733b987d3 (patch) | |
tree | 91739126eb386685656c7e30dcc2fffae826d2ed /scripts/qapi | |
parent | e51e80ccf671dc285d0f868fff38aedb01694ae9 (diff) |
qapi: Improve error position for bogus argument descriptions
When documented arguments don't exist, the error message points to the
beginning of the definition comment. Point to the first bogus
argument description instead.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240216145841.2099240-6-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'scripts/qapi')
-rw-r--r-- | scripts/qapi/parser.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py index 88221b3c64..82db595dcf 100644 --- a/scripts/qapi/parser.py +++ b/scripts/qapi/parser.py @@ -472,6 +472,8 @@ class QAPIDoc: # pylint: disable=too-few-public-methods def __init__(self, parser: QAPISchemaParser, name: Optional[str] = None): + # section source info, i.e. where it begins + self.info = parser.info # parser, for error messages about indentation self._parser = parser # optional section name (argument/member or section name) @@ -770,7 +772,7 @@ class QAPIDoc: if not section.member] if bogus: raise QAPISemError( - self.info, + args[bogus[0]].info, "documented %s%s '%s' %s not exist" % ( what, "s" if len(bogus) > 1 else "", |