Add property error
PropertyError is defined in the DMTF schemas, and will be used in
the next patchset.
Tested: Code compiles. No functional changes.
Change-Id: Ib5f0e2025e07c9add41e5e8df8288d7e54104ee7
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index 0db320b..5866e27 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -580,6 +580,17 @@
std::string_view arg2);
/**
+ * @brief Formats PropertyValueError message into JSON
+ * Message body: "The value provided for the property <arg1> is not valid."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ *
+ * @returns Message PropertyValueTypeError formatted to JSON */
+nlohmann::json propertyValueError(std::string_view arg1);
+
+void propertyValueError(crow::Response& res, std::string_view arg1);
+
+/**
* @brief Formats ResourceNotFound message into JSON
* Message body: "The requested resource of type <arg1> named <arg2> was not
* found."
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index fd55d89..7bb8a37 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -1015,6 +1015,26 @@
/**
* @internal
+ * @brief Formats PropertyValueError message into JSON for the specified
+ * property
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json propertyValueError(std::string_view arg1)
+{
+ return getLog(redfish::registries::base::Index::propertyValueError,
+ std::to_array<std::string_view>({arg1}));
+}
+
+void propertyValueError(crow::Response& res, std::string_view arg1)
+{
+ res.result(boost::beast::http::status::bad_request);
+ addMessageToJson(res.jsonValue, propertyValueError(arg1), arg1);
+}
+
+/**
+ * @internal
* @brief Formats ResourceNotFound message into JSONd
*
* See header file for more information