rest_dbus: Add read-only property error
There is now support in sdbusplus to mark a property as
read-only, so that a REST request to modify it would return
org.freedesktop.DBus.Error.PropertyReadOnly.
Add support for this error to provide a more useful and
compact error instead of the default 500 Internal Error with
the traceback.
Tested:
Instead of a 500 error with traceback, a compact 403 error
is displayed:
$ curl b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": 50}' https://${bmc}/xyz/openbmc_project/control/power_supply/attr/DeratingFactor
{
"data": {
"description": "org.freedesktop.DBus.Error.PropertyReadOnly: Property 'DeratingFactor' is not writable."
},
"message": "403 Forbidden",
"status": "error"
}
Change-Id: I5648a99c7656a6f9d9a8ca967418fabd64b080c6
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
1 file changed