From 8e26ae7bb58d10c04599eabd265217da050514a4 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 13 Nov 2020 07:23:58 +0100 Subject: authz-list-file: Improve an error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When qauthz_list_file_load() rejects JSON values other than JSON object with a rather confusing error message: $ echo 1 | qemu-system-x86_64 -nodefaults -S -display none -object authz-list-file,id=authz0,filename=/dev/stdin qemu-system-x86_64: -object authz-list-file,id=authz0,filename=/dev/stdin: Invalid parameter type for 'obj', expected: dict Improve to qemu-system-x86_64: -object authz-list-file,id=authz0,filename=/dev/stdin: File '/dev/stdin' must contain a JSON object Signed-off-by: Markus Armbruster Signed-off-by: Daniel P. Berrangé --- authz/listfile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'authz') diff --git a/authz/listfile.c b/authz/listfile.c index 1421e67..da3a0e6 100644 --- a/authz/listfile.c +++ b/authz/listfile.c @@ -73,7 +73,8 @@ qauthz_list_file_load(QAuthZListFile *fauthz, Error **errp) pdict = qobject_to(QDict, obj); if (!pdict) { - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "obj", "dict"); + error_setg(errp, "File '%s' must contain a JSON object", + fauthz->filename); goto cleanup; } -- cgit v1.1