From ea29331ba6c0e622e63424cc8495177ed7655a77 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 20 Oct 2021 20:02:31 +0200 Subject: qapi: Improve input_type_enum()'s error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The error message claims the parameter is invalid: $ qemu-system-x86_64 -object qom-type=nonexistent qemu-system-x86_64: -object qom-type=nonexistent: Invalid parameter 'nonexistent' What's wrong is actually the *value* 'nonexistent'. Improve the message to qemu-system-x86_64: -object qom-type=nonexistent: Parameter 'qom-type' does not accept value 'nonexistent' Fixes: https://gitlab.com/qemu-project/qemu/-/issues/608 Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20211020180231.434071-1-armbru@redhat.com> Reviewed-by: Kevin Wolf --- qapi/qapi-visit-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qapi/qapi-visit-core.c') diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index a641adec51..7310f0a0ca 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -392,7 +392,8 @@ static bool input_type_enum(Visitor *v, const char *name, int *obj, value = qapi_enum_parse(lookup, enum_str, -1, NULL); if (value < 0) { - error_setg(errp, QERR_INVALID_PARAMETER, enum_str); + error_setg(errp, "Parameter '%s' does not accept value '%s'", + name ? name : "null", enum_str); g_free(enum_str); return false; } -- cgit v1.2.3