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>
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 0f4a902..3eb4097 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 @@
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);