[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 10/21] monitor: Propagate errors through qmp_check_in
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 10/21] monitor: Propagate errors through qmp_check_input_obj() |
Date: |
Tue, 2 Jun 2015 10:23:48 +0200 |
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Luiz Capitulino <address@hidden>
---
monitor.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/monitor.c b/monitor.c
index 0afcf60..61ea346 100644
--- a/monitor.c
+++ b/monitor.c
@@ -4929,14 +4929,14 @@ out:
* 5. If the "id" key exists, it can be anything (ie. json-value)
* 6. Any argument not listed above is considered invalid
*/
-static QDict *qmp_check_input_obj(QObject *input_obj)
+static QDict *qmp_check_input_obj(QObject *input_obj, Error **errp)
{
const QDictEntry *ent;
int has_exec_key = 0;
QDict *input_dict;
if (qobject_type(input_obj) != QTYPE_QDICT) {
- qerror_report(QERR_QMP_BAD_INPUT_OBJECT, "object");
+ error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "object");
return NULL;
}
@@ -4948,25 +4948,25 @@ static QDict *qmp_check_input_obj(QObject *input_obj)
if (!strcmp(arg_name, "execute")) {
if (qobject_type(arg_obj) != QTYPE_QSTRING) {
- qerror_report(QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "execute",
- "string");
+ error_set(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
+ "execute", "string");
return NULL;
}
has_exec_key = 1;
} else if (!strcmp(arg_name, "arguments")) {
if (qobject_type(arg_obj) != QTYPE_QDICT) {
- qerror_report(QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "arguments",
- "object");
+ error_set(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
+ "arguments", "object");
return NULL;
}
} else {
- qerror_report(QERR_QMP_EXTRA_MEMBER, arg_name);
+ error_set(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
return NULL;
}
}
if (!has_exec_key) {
- qerror_report(QERR_QMP_BAD_INPUT_OBJECT, "execute");
+ error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
return NULL;
}
@@ -4992,8 +4992,9 @@ static void handle_qmp_command(JSONMessageParser *parser,
QList *tokens)
goto err_out;
}
- input = qmp_check_input_obj(obj);
+ input = qmp_check_input_obj(obj, &local_err);
if (!input) {
+ qerror_report_err(local_err);
qobject_decref(obj);
goto err_out;
}
--
1.9.3
- [Qemu-devel] [PULL 05/21] monitor: Use traditional command interface for HMP drive_del, (continued)
- [Qemu-devel] [PULL 05/21] monitor: Use traditional command interface for HMP drive_del, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 06/21] monitor: Use traditional command interface for HMP device_add, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 09/21] monitor: Propagate errors through qmp_check_client_args(), Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 07/21] monitor: Use trad. command interface for HMP pcie_aer_inject_error, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 03/21] monitor: Improve and document client_migrate_info protocol error, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 04/21] monitor: Convert client_migrate_info to QAPI, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 01/21] monitor: Drop broken, unused asynchronous command interface, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 13/21] monitor: Inline monitor_has_error() into its only caller, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 20/21] monitor: Rename monitor_ctrl_mode() to monitor_is_qmp(), Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 21/21] monitor: Change return type of monitor_cur_is_qmp() to bool, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 10/21] monitor: Propagate errors through qmp_check_input_obj(),
Markus Armbruster <=
- [Qemu-devel] [PULL 16/21] monitor: Rename monitor_control_read(), monitor_control_event(), Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 15/21] monitor: Rename handle_user_command() to handle_hmp_command(), Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 18/21] monitor: Drop do_qmp_capabilities()'s superfluous QMP check, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 19/21] monitor: Turn int command_mode into bool in_command_mode, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 17/21] monitor: Unbox Monitor member mc and rename to qmp, Markus Armbruster, 2015/06/02
- [Qemu-devel] [PULL 14/21] monitor: Limit QError use to command handlers, Markus Armbruster, 2015/06/02
- Re: [Qemu-devel] [PULL 00/21] Monitor patches, Peter Maydell, 2015/06/04