qom: Improve error message displayed with missing object properties
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sun, 20 Sep 2020 15:53:40 +0000 (17:53 +0200)
committerEduardo Habkost <ehabkost@redhat.com>
Tue, 6 Oct 2020 15:09:35 +0000 (11:09 -0400)
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

index c335dce7e4a466eb5f3f3c949d977dd0f48769aa..10653552334549241cd5672d7a027ad57432c482 100644 (file)
@@ -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;
 }