From de2b67e52824234100e2022870af07951f2ebfe4 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 19 Feb 2018 17:55:32 -0500 Subject: [PATCH] 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. Backports commit 7408fb67c0f9403f6e40aecf97cf798fc14e2cd8 from qemu --- qemu/scripts/qapi.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qemu/scripts/qapi.py b/qemu/scripts/qapi.py index 8050593c..a505dd7e 100644 --- a/qemu/scripts/qapi.py +++ b/qemu/scripts/qapi.py @@ -132,8 +132,7 @@ class QAPISchemaParser(object): include = expr["include"] if not isinstance(include, str): raise QAPIExprError(expr_info, - 'Expected a file name (string), got: %s' - % include) + "Value of 'include' must be a string") incl_abs_fname = os.path.join(os.path.dirname(abs_fname), include) # catch inclusion cycle