From d6091dddfa28afa5fda0bf4175a009d70bfa309a Mon Sep 17 00:00:00 2001 From: Matt Spinler Date: Thu, 6 Dec 2018 14:08:27 -0600 Subject: 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 --- include/openbmc_dbus_rest.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 &objectPaths) { if (ec) { - res.result(boost::beast::http::status::internal_server_error); + setErrorResponse(res, boost::beast::http::status::not_found, + notFoundDesc, notFoundMsg); } else { -- cgit v1.2.3