Make propertyValueTypeError more typesafe
Similar to the prior patchset in this series, propertyValueTypeError can
be moved to safer constructs. This ensures that we are minimizing how
many places we are calling dump() from, and allows us to reduce the
amount of code written for error handling.
Tested:
PATCH /redfish/v1/SessionService {"SessionTimeout": "foo"}
Returns PropertyValueTypeError in the same behavior as prior to this
patch.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iddff4b787f35c49bf923663d61bba156687f358c
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 1d2c988..411659d 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1233,11 +1233,8 @@
{
if (input.empty())
{
- messages::propertyValueTypeError(
- asyncResp->res,
- nlohmann::json(input).dump(
- 2, ' ', true, nlohmann::json::error_handler_t::replace),
- "IPv4StaticAddresses");
+ messages::propertyValueTypeError(asyncResp->res, input,
+ "IPv4StaticAddresses");
return;
}
@@ -1438,11 +1435,8 @@
{
if (input.empty())
{
- messages::propertyValueTypeError(
- asyncResp->res,
- nlohmann::json(input).dump(
- 2, ' ', true, nlohmann::json::error_handler_t::replace),
- "IPv6StaticAddresses");
+ messages::propertyValueTypeError(asyncResp->res, input,
+ "IPv6StaticAddresses");
return;
}
size_t entryIdx = 1;