[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/4] qom: Improve error messages when property has no getter or se
From: |
Markus Armbruster |
Subject: |
[PULL 1/4] qom: Improve error messages when property has no getter or setter |
Date: |
Fri, 28 Oct 2022 08:08:13 +0200 |
When you try to set a property that has no setter, the error message
blames "insufficient permission":
$ qemu-system-x86_64 -S -display none -nodefaults -monitor stdio
QEMU 7.1.50 monitor - type 'help' for more information
(qemu) qom-set /machine type q35
Error: Insufficient permission to perform this operation
This implies it could work with "sufficient permission". It can't.
Change the error message to:
Error: Property 'pc-i440fx-7.2-machine.type' is not writable
Do the same for getting a property that has no getter.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221012153801.2604340-2-armbru@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
---
qom/object.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index d34608558e..e5cef30f6d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1383,7 +1383,8 @@ bool object_property_get(Object *obj, const char *name,
Visitor *v,
}
if (!prop->get) {
- error_setg(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, "Property '%s.%s' is not readable",
+ object_get_typename(obj), name);
return false;
}
prop->get(obj, v, name, prop->opaque, &err);
@@ -1402,7 +1403,8 @@ bool object_property_set(Object *obj, const char *name,
Visitor *v,
}
if (!prop->set) {
- error_setg(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, "Property '%s.%s' is not writable",
+ object_get_typename(obj), name);
return false;
}
prop->set(obj, v, name, prop->opaque, errp);
--
2.37.3
- [PULL 0/4] Error reporting patches for 2022-10-28, Markus Armbruster, 2022/10/28
- [PULL 2/4] backends: Improve error messages when property can no longer be set, Markus Armbruster, 2022/10/28
- [PULL 3/4] qtest: Improve error messages when property can not be set right now, Markus Armbruster, 2022/10/28
- [PULL 1/4] qom: Improve error messages when property has no getter or setter,
Markus Armbruster <=
- [PULL 4/4] qerror: QERR_PERMISSION_DENIED is no longer used, drop, Markus Armbruster, 2022/10/28
- Re: [PULL 0/4] Error reporting patches for 2022-10-28, Stefan Hajnoczi, 2022/10/31