diff options
author | Matt Spinler <spinler@us.ibm.com> | 2018-12-06 23:08:27 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2018-12-14 00:55:44 +0300 |
commit | d6091dddfa28afa5fda0bf4175a009d70bfa309a (patch) | |
tree | c2ca69292df00bd8f7d7e48fc578392eb26dc5a7 | |
parent | dc2f9f11e726c02667e1c35080b15b20a4e62b33 (diff) | |
download | bmcweb-d6091dddfa28afa5fda0bf4175a009d70bfa309a.tar.xz |
REST: For list, return the error in JSON
The only way list can fail is if the GetSubTreePaths call fails,
and that will only happen if the path isn't a valid D-Bus object.
In that case, return the standard REST error JSON response for
org.freedesktop.DBus.Error.FileNotFound.
Change-Id: I538d3132552590e51f9ede80762aee00c59cb3e9
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-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 0ab3908473..a142426c3c 100644 --- a/include/openbmc_dbus_rest.hpp +++ b/include/openbmc_dbus_rest.hpp @@ -929,7 +929,8 @@ void handleList(crow::Response &res, const std::string &objectPath, std::vector<std::string> &objectPaths) { if (ec) { - res.result(boost::beast::http::status::internal_server_error); + setErrorResponse(res, boost::beast::http::status::not_found, + notFoundDesc, notFoundMsg); } else { |