[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 09/27] qmp: Eliminate silly QERR_QMP_* macros
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL v2 09/27] qmp: Eliminate silly QERR_QMP_* macros |
Date: |
Sun, 5 Mar 2017 09:35:40 +0100 |
The QERR_ macros are leftovers from the days of "rich" error objects.
QERR_QMP_BAD_INPUT_OBJECT, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
QERR_QMP_EXTRA_MEMBER are used in just one place now, except for one
use that has crept into qobject-input-visitor.c.
Drop these macros, to make the (bad) error messages more visible.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-Id: <address@hidden>
---
include/qapi/qmp/qerror.h | 9 ---------
qapi/qmp-dispatch.c | 13 +++++++------
qapi/qobject-input-visitor.c | 3 ++-
3 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h
index 6586c9f..c82360f 100644
--- a/include/qapi/qmp/qerror.h
+++ b/include/qapi/qmp/qerror.h
@@ -82,15 +82,6 @@
#define QERR_QGA_COMMAND_FAILED \
"Guest agent command failed, error was '%s'"
-#define QERR_QMP_BAD_INPUT_OBJECT \
- "Expected '%s' in QMP input"
-
-#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
- "QMP input object member '%s' expects '%s'"
-
-#define QERR_QMP_EXTRA_MEMBER \
- "QMP input object member '%s' is unexpected"
-
#define QERR_SET_PASSWD_FAILED \
"Could not set password"
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index 7fb8aef..dc50212 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -30,7 +30,7 @@ static QDict *qmp_dispatch_check_obj(const QObject *request,
Error **errp)
dict = qobject_to_qdict(request);
if (!dict) {
- error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "object");
+ error_setg(errp, "Expected '%s' in QMP input", "object");
return NULL;
}
@@ -41,25 +41,26 @@ static QDict *qmp_dispatch_check_obj(const QObject
*request, Error **errp)
if (!strcmp(arg_name, "execute")) {
if (qobject_type(arg_obj) != QTYPE_QSTRING) {
- error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "execute",
- "string");
+ error_setg(errp, "QMP input object member '%s' expects '%s'",
+ "execute", "string");
return NULL;
}
has_exec_key = true;
} else if (!strcmp(arg_name, "arguments")) {
if (qobject_type(arg_obj) != QTYPE_QDICT) {
- error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
+ error_setg(errp, "QMP input object member '%s' expects '%s'",
"arguments", "object");
return NULL;
}
} else {
- error_setg(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
+ error_setg(errp, "QMP input object member '%s' is unexpected",
+ arg_name);
return NULL;
}
}
if (!has_exec_key) {
- error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
+ error_setg(errp, "Expected '%s' in QMP input", "execute");
return NULL;
}
diff --git a/qapi/qobject-input-visitor.c b/qapi/qobject-input-visitor.c
index 0063327..ed6c24c 100644
--- a/qapi/qobject-input-visitor.c
+++ b/qapi/qobject-input-visitor.c
@@ -140,7 +140,8 @@ static void qobject_input_check_struct(Visitor *v, Error
**errp)
g_hash_table_iter_init(&iter, top_ht);
if (g_hash_table_iter_next(&iter, (void **)&key, NULL)) {
- error_setg(errp, QERR_QMP_EXTRA_MEMBER, key);
+ error_setg(errp, "QMP input object member '%s' is unexpected",
+ key);
}
}
}
--
2.7.4
- [Qemu-devel] [PULL v2 00/27] QAPI patches for 2017-02-28, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 11/27] qapi: Clean up after commit 3d344c2, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 06/27] qapi-introspect: Mangle --prefix argument properly for C, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 12/27] qapi: Make QObject input visitor set *list reliably, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 03/27] qmp-test: New, covering basic QMP protocol, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 02/27] libqtest: Work around a "QMP wants a newline" bug, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 09/27] qmp: Eliminate silly QERR_QMP_* macros,
Markus Armbruster <=
- [Qemu-devel] [PULL v2 01/27] qga: Fix crash on non-dictionary QMP argument, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 23/27] test-qobject-input-visitor: Cover missing nested struct member, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 17/27] test-qobject-input-visitor: Use strict visitor, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 26/27] qapi: Fix object input visit beyond end of list, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 10/27] qapi: Improve a QObject input visitor error message, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 04/27] qmp: Dumb down how we run QMP command registration, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 16/27] qom: Make object_property_set_qobject()'s input visitor strict, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 13/27] qapi: Improve qobject input visitor error reporting, Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 14/27] qapi: Drop string input visitor method optional(), Markus Armbruster, 2017/03/05
- [Qemu-devel] [PULL v2 07/27] qmp: Clean up how we enforce capability negotiation, Markus Armbruster, 2017/03/05