Pass correct Argument Types to propertyValueIncorrect Error Message
Changed the code to pass the parameters according to their types.
Tested: Code Compiles properly and tested.
Change-Id: Ie0e13d39cd892afda36dfabec871f0fe8d8498e4
Signed-off-by: Ginu George <ginugeorge@ami.com>
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index 09ac36e..7adae19 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -491,11 +491,11 @@
* @param[in] arg2 Parameter of message that will replace %2 in its body.
*
* @returns Message PropertyValueIncorrect formatted to JSON */
-nlohmann::json propertyValueIncorrect(const nlohmann::json& arg1,
- std::string_view arg2);
+nlohmann::json propertyValueIncorrect(std::string_view arg1,
+ const nlohmann::json& arg2);
-void propertyValueIncorrect(crow::Response& res, const nlohmann::json& arg1,
- std::string_view arg2);
+void propertyValueIncorrect(crow::Response& res, std::string_view arg1,
+ const nlohmann::json& arg2);
/**
* @brief Formats ResourceCreationConflict message into JSON
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index 6ad9f11..43a1849 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -737,7 +737,7 @@
metricProperties.emplace_back(uri);
}
messages::propertyValueIncorrect(
- asyncResp->res, metricProperties, "MetricProperties");
+ asyncResp->res, "MetricProperties", metricProperties);
return;
}
if (ec)
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index 7bbd877..3c628b6 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -860,17 +860,17 @@
* See header file for more information
* @endinternal
*/
-nlohmann::json propertyValueIncorrect(const nlohmann::json& arg1,
- std::string_view arg2)
+nlohmann::json propertyValueIncorrect(std::string_view arg1,
+ const nlohmann::json& arg2)
{
- std::string arg1Str = arg1.dump(2, ' ', true,
+ std::string arg2Str = arg2.dump(2, ' ', true,
nlohmann::json::error_handler_t::replace);
return getLog(redfish::registries::base::Index::propertyValueIncorrect,
- std::to_array<std::string_view>({arg1Str, arg2}));
+ std::to_array<std::string_view>({arg1, arg2Str}));
}
-void propertyValueIncorrect(crow::Response& res, const nlohmann::json& arg1,
- std::string_view arg2)
+void propertyValueIncorrect(crow::Response& res, std::string_view arg1,
+ const nlohmann::json& arg2)
{
res.result(boost::beast::http::status::bad_request);
addMessageToErrorJson(res.jsonValue, propertyValueIncorrect(arg1, arg2));