diff mbox series

[v2,3/3] qom/object: Make reparenting error more verbose

Message ID 20200504115656.6045-4-f4bug@amsat.org
State New
Headers show
Series None | expand

Commit Message

Philippe Mathieu-Daudé May 4, 2020, 11:56 a.m. UTC
Display child and parent names when reparenting occurs.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 qom/object.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/qom/object.c b/qom/object.c
index be700e831f..417fd90aa5 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1683,7 +1683,12 @@  void object_property_add_child(Object *obj, const char *name,
     ObjectProperty *op;
 
     if (child->parent != NULL) {
-        error_setg(errp, "child object is already parented");
+        error_setg(errp, "child object '%s' is already parented (parent: '%s') "
+                         "can not be children '%s' of '%s'",
+                   object_get_typename(child),
+                   object_get_typename(child->parent),
+                   name,
+                   object_get_typename(obj));
         return;
     }