Patchwork [v3,11/34] qmp: improve error reporting for -object and object-add

login
register
mail settings
Submitter Hu Tao
Date March 26, 2014, 10:36 a.m.
Message ID <d123e87b4a57f44c2aca0cb4f569eb16c28c9a4c.1395825870.git.hutao@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/333894/
State New
Headers show

Comments

Hu Tao - March 26, 2014, 10:36 a.m.
From: Paolo Bonzini <pbonzini@redhat.com>

Use QERR_INVALID_PARAMETER_VALUE for consistency.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qmp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/qmp.c b/qmp.c
index 54b95ba..440f3ab 100644
--- a/qmp.c
+++ b/qmp.c
@@ -544,7 +544,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;
     }