summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2019-11-27 01:59:21 +0300
committerJason Bills <jason.m.bills@linux.intel.com>2019-12-02 19:53:55 +0300
commit1ddcf01a159779cb5af2992b8f1e8ba9ab7484a5 (patch)
tree71a5ce6efb1cbb7558d82ae64e76e6b6f519bd6d /redfish-core
parente195977836ef5135d9362f40e8755da8c34dc0d7 (diff)
downloadbmcweb-1ddcf01a159779cb5af2992b8f1e8ba9ab7484a5.tar.xz
Return a 404 instead of 500 for invalid Crashdump URIs
Tested: Used a browser to request an invalid Crashdump URI and got a 404 with a resource not found error. Change-Id: Idcac7868bb1f3b4c0248926b46be2cf4fce05328 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/lib/log_services.hpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 0f4a90226f..3eb4097bf9 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -25,6 +25,7 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/beast/core/span.hpp>
#include <boost/container/flat_map.hpp>
+#include <boost/system/linux_error.hpp>
#include <error_messages.hpp>
#include <filesystem>
#include <string_view>
@@ -1625,7 +1626,15 @@ static void logCrashdumpEntry(std::shared_ptr<AsyncResp> asyncResp,
if (ec)
{
BMCWEB_LOG_DEBUG << "failed to get log ec: " << ec.message();
- messages::internalError(asyncResp->res);
+ if (ec.value() ==
+ boost::system::linux_error::bad_request_descriptor)
+ {
+ messages::resourceNotFound(asyncResp->res, "LogEntry", logID);
+ }
+ else
+ {
+ messages::internalError(asyncResp->res);
+ }
return;
}
const std::string *log = std::get_if<std::string>(&resp);