qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

qapi: Improve 'include' error message

Use of '"...%s" % include' to print non-strings can lead to
ugly messages, such as this (if the .json change is applied
without the qapi.py change):
Expected a file name (string), got: OrderedDict()

Better is to just omit the actual non-string value in the
message.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1443565276-4535-3-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>

authored by

Eric Blake and committed by
Markus Armbruster
7408fb67 1ffe818a

+3 -4
+1 -2
scripts/qapi.py
··· 132 132 include = expr["include"] 133 133 if not isinstance(include, str): 134 134 raise QAPIExprError(expr_info, 135 - 'Expected a file name (string), got: %s' 136 - % include) 135 + "Value of 'include' must be a string") 137 136 incl_abs_fname = os.path.join(os.path.dirname(abs_fname), 138 137 include) 139 138 # catch inclusion cycle
+1 -1
tests/qapi-schema/include-non-file.err
··· 1 - tests/qapi-schema/include-non-file.json:1: Expected a file name (string), got: ['foo', 'bar'] 1 + tests/qapi-schema/include-non-file.json:1: Value of 'include' must be a string
+1 -1
tests/qapi-schema/include-non-file.json
··· 1 - { 'include': [ 'foo', 'bar' ] } 1 + { 'include': {} }