bmcweb: merge conflict resolution
Merge conflict in: Improve the Redfish error reporting interface
Makes the Redfish error reporting interface automatically handle
setting the http status and JSON content in the response object.
When using an AsyncResp object, this allows for simply calling
the Redfish error and returning.
Change-Id: I3b37cce1e7f603c0b4cc74a16f8f00da9a7f1373
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 85ef1b0..c9555a1 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -248,20 +248,17 @@
skip = std::strtol(skipParam, &ptr, 10);
if (*skipParam == '\0' || *ptr != '\0')
{
- messages::addMessageToErrorJson(
- asyncResp->res.jsonValue,
- messages::queryParameterValueTypeError(
- std::string(skipParam), "$skip"));
- asyncResp->res.result(boost::beast::http::status::bad_request);
+
+ messages::queryParameterValueTypeError(
+ asyncResp->res, std::string(skipParam), "$skip");
return;
}
if (skip < 0)
{
- messages::addMessageToErrorJson(
- asyncResp->res.jsonValue,
- messages::queryParameterOutOfRange(
- std::to_string(skip), "$skip", "greater than 0"));
- asyncResp->res.result(boost::beast::http::status::bad_request);
+
+ messages::queryParameterOutOfRange(asyncResp->res,
+ std::to_string(skip),
+ "$skip", "greater than 0");
return;
}
}
@@ -272,20 +269,16 @@
top = std::strtol(topParam, &ptr, 10);
if (*topParam == '\0' || *ptr != '\0')
{
- messages::addMessageToErrorJson(
- asyncResp->res.jsonValue,
- messages::queryParameterValueTypeError(
- std::string(topParam), "$top"));
- asyncResp->res.result(boost::beast::http::status::bad_request);
+ messages::queryParameterValueTypeError(
+ asyncResp->res, std::string(topParam), "$top");
return;
}
if (top < 1 || top > maxEntriesPerPage)
{
- messages::addMessageToErrorJson(
- asyncResp->res.jsonValue,
- messages::queryParameterOutOfRange(
- std::to_string(top), "$top",
- "1-" + std::to_string(maxEntriesPerPage)));
+
+ messages::queryParameterOutOfRange(
+ asyncResp->res, std::to_string(top), "$top",
+ "1-" + std::to_string(maxEntriesPerPage));
asyncResp->res.result(boost::beast::http::status::bad_request);
return;
}