Skip to contentSkip to conversation

qom: Improve error message displayed with missing object properties

PATCH In review Philippe Mathieu-Daudé 4 participants 6 messages Sep 20, 2020 – Oct 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qom: Improve error message displayed with missing object properties

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.

---
 qom/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
qom/object.c +2 -1
index 387efb25ebe..257914b1fe3 100644
@@ -1259,7 +1259,8 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
         return prop;
     }
 
-    error_setg(errp, "Property '.%s' not found", name);
+    error_setg(errp, "Property '%s.%s' not found",
+               object_get_typename(obj), name);
     return NULL;
 }
 
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Philippe Mathieu-Daudé <[email protected]> 于2020年9月20日周日 下午11:54写道:

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.

Quoted 22 lines
---
 qom/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
qom/object.c +2 -2
index 387efb25ebe..257914b1fe3 100644
@@ -1259,7 +1259,8 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
         return prop;
     }
 
-    error_setg(errp, "Property '.%s' not found", name);
+    error_setg(errp, "Property '%s.%s' not found",
+               object_get_typename(obj), name);
     return NULL;
 }
 
--

2.26.2

#2 lore raw
In reply to Philippe Mathieu-Daudé

Eduardo, can you take this patch, or can it goes via qemu-trivial?

Quoted 24 lines · Philippe Mathieu-Daudé

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.

---
 qom/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
qom/object.c +2 -1
index 387efb25ebe..257914b1fe3 100644
@@ -1259,7 +1259,8 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
         return prop;
     }
 
-    error_setg(errp, "Property '.%s' not found", name);
+    error_setg(errp, "Property '%s.%s' not found",
+               object_get_typename(obj), name);
     return NULL;
 }
 
Acked-by on v1 1/1
#3 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 15 lines · Philippe Mathieu-Daudé

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.

---
 qom/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
qom/object.c +0 -0
index 387efb25ebe..257914b1fe3 100644

qom/object.c ObjectProperty *object_property_find(Object *obj, const char *name, · line 1266

Quoted 9 lines
qom/object.c +2 -1
@@ -1259,7 +1259,8 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
         return prop;
     }
 
-    error_setg(errp, "Property '.%s' not found", name);
+    error_setg(errp, "Property '%s.%s' not found",
+               object_get_typename(obj), name);
     return NULL;
 }
 

I think it's okay for qemu-trivial.

#4 lore raw
Quoted 28 lines · Paolo Bonzini
Quoted 15 lines · Philippe Mathieu-Daudé

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.

---
 qom/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
qom/object.c +0 -0
index 387efb25ebe..257914b1fe3 100644

qom/object.c ObjectProperty *object_property_find(Object *obj, const char *name, · line 1266

Quoted 9 lines
qom/object.c +2 -1
@@ -1259,7 +1259,8 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
         return prop;
     }
 
-    error_setg(errp, "Property '.%s' not found", name);
+    error_setg(errp, "Property '%s.%s' not found",
+               object_get_typename(obj), name);
     return NULL;
 }
 
Quoted 1 line

I think it's okay for qemu-trivial.

It would be okay, but it doesn't apply on master anymore due to the object_propert_find_err() refactor. I've fixed the conflicts and queued it on machine-next.

Signature · 1 line
Eduardo
#5 lore raw
Quoted 29 lines · Eduardo Habkost
Quoted 28 lines · Paolo Bonzini
Quoted 15 lines · Philippe Mathieu-Daudé

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.

---
 qom/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
qom/object.c +0 -0
index 387efb25ebe..257914b1fe3 100644

qom/object.c ObjectProperty *object_property_find(Object *obj, const char *name, · line 1266

Quoted 9 lines
qom/object.c +2 -1
@@ -1259,7 +1259,8 @@ ObjectProperty *object_property_find(Object *obj, const char *name,
         return prop;
     }
 
-    error_setg(errp, "Property '.%s' not found", name);
+    error_setg(errp, "Property '%s.%s' not found",
+               object_get_typename(obj), name);
     return NULL;
 }
 
Quoted 5 lines
Quoted 1 line

I think it's okay for qemu-trivial.

It would be okay, but it doesn't apply on master anymore due to the object_propert_find_err() refactor. I've fixed the conflicts and queued it on machine-next.

Oh sorry I didn't noticed, thanks for fixing/queuing!

Phil.