diff mbox series

[PULL,10/21] qom: Improve error message displayed with missing object properties

Message ID 20201005211000.710404-11-ehabkost@redhat.com
State New
Headers show
Series machine + QOM queue, 2020-10-05 | expand

Commit Message

Eduardo Habkost Oct. 5, 2020, 9:09 p.m. UTC
From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Instead of only displaying the property missing, also display
the object name. This help developer to quickly figure out the
mistake without opening a debugger.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200920155340.401482-1-f4bug@amsat.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qom/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/qom/object.c b/qom/object.c
index c335dce7e4a..10653552334 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1291,7 +1291,8 @@  ObjectProperty *object_property_find_err(Object *obj, const char *name,
 {
     ObjectProperty *prop = object_property_find(obj, name);
     if (!prop) {
-        error_setg(errp, "Property '.%s' not found", name);
+        error_setg(errp, "Property '%s.%s' not found",
+                   object_get_typename(obj), name);
     }
     return prop;
 }