[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2.1 11/28] qmp: improve error reporting for -object
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 2.1 11/28] qmp: improve error reporting for -object and object-add |
Date: |
Tue, 4 Mar 2014 15:00:39 +0100 |
Use QERR_INVALID_PARAMETER_VALUE for consistency, and avoid an assertion
failure if the class name is incorrect.
Signed-off-by: Paolo Bonzini <address@hidden>
---
qmp.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/qmp.c b/qmp.c
index 2ff943d..a3b0b73 100644
--- a/qmp.c
+++ b/qmp.c
@@ -541,7 +541,8 @@ void object_add(const char *type, const char *id, const
QDict *qdict,
Error *local_err = NULL;
if (!object_class_by_name(type)) {
- error_setg(errp, "invalid class name");
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE,
+ "qom-type", "a valid class name");
return;
}
@@ -556,8 +557,8 @@ void object_add(const char *type, const char *id, const
QDict *qdict,
}
if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) {
- error_setg(&local_err, "object '%s' isn't supported by object-add",
- id);
+ error_setg(&local_err, "class '%s' isn't supported by object-add",
+ type);
goto out;
}
--
1.8.5.3
- Re: [Qemu-devel] [PATCH 2.1 07/28] qemu-option: introduce qemu_find_opts_singleton, (continued)
- [Qemu-devel] [PATCH 2.1 08/28] vl: convert -m to QemuOpts, Paolo Bonzini, 2014/03/04
- [Qemu-devel] [PATCH 2.1 09/28] vl: redo -object parsing, Paolo Bonzini, 2014/03/04
- [Qemu-devel] [PATCH 2.1 10/28] qmp: allow object-add completion handler to get canonical path, Paolo Bonzini, 2014/03/04
- [Qemu-devel] [PATCH 2.1 11/28] qmp: improve error reporting for -object and object-add,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 2.1 12/28] pc: pass QEMUMachineInitArgs to pc_memory_init, Paolo Bonzini, 2014/03/04
- [Qemu-devel] [PATCH 2.1 13/28] numa: introduce memory_region_allocate_system_memory, Paolo Bonzini, 2014/03/04
- [Qemu-devel] [PATCH 2.1 14/28] add memdev backend infrastructure, Paolo Bonzini, 2014/03/04
- [Qemu-devel] [PATCH 2.1 15/28] numa: add -numa node, memdev= option, Paolo Bonzini, 2014/03/04