diff options
author | Lei YU <mine260309@gmail.com> | 2019-05-16 10:31:18 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-05-30 00:28:41 +0300 |
commit | c72aa4757b57da6e4dae2325b7d0570c6be3d89b (patch) | |
tree | e711ef20a9ab5447b65a7bed78bcf986ec402ada /include | |
parent | da131a9a053f304528cae6573f97bb6f3db951b2 (diff) | |
download | bmcweb-c72aa4757b57da6e4dae2325b7d0570c6be3d89b.tar.xz |
REST: PUT: return DBus error description
The boost::system::error_code returned by the DBus call will contain the
DBus error name and description in its error_category, use the
category's name and message as REST API's description and message.
Tested: Verify the REST API output when trying to set host time while
the settings does not allow that:
$ curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PUT -d '{"data": 1436655598435272}' https://$bmc/xyz/openbmc_project/time/bmc/attr/Elapsed
{
"data": {
"description": "xyz.openbmc_project.Time.Error.NotAllowed"
},
"message": "The operation is not allowed",
"status": "error"
}
Resolves openbmc/bmcweb#83
Change-Id: I90c11c0fc61e55329c809ecb5f948ae041a579d0
Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/openbmc_dbus_rest.hpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp index 6938079f23..af6451de2a 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -1871,7 +1871,8 @@ void handlePut(const crow::Request &req, crow::Response &res, boost::beast::http:: status:: forbidden, - forbiddenPropDesc, + ec.category() + .name(), ec.message()); } else |