error_messages: Add PropertyValueOutOfRange error

The PropertyValueOutOfRange error indicates that a property was given
the correct value type but the value of that property is outside the
supported range.

Tested:
Build pass.

Change-Id: I78d5e3142b41d6739e6b0ff4699e1c731c5981d7
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
index ed00447..f2b7d23 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
@@ -243,6 +243,21 @@
                             std::string_view arg2);
 
 /**
+ * @brief Formats PropertyValueOutOfRange message into JSON
+ * Message body: "The value '%1' for the property %2 is not in the supported
+ * range of acceptable values."
+ *
+ * @param[in] arg1 Parameter of message that will replace %1 in its body.
+ * @param[in] arg2 Parameter of message that will replace %2 in its body.
+ *
+ * @returns Message PropertyValueExternalConflict formatted to JSON */
+nlohmann::json propertyValueOutOfRange(std::string_view arg1,
+                                       std::string_view arg2);
+
+void propertyValueOutOfRange(crow::Response& res, std::string_view arg1,
+                             std::string_view arg2);
+
+/**
  * @brief Formats ResourceAtUriInUnknownFormat message into JSON
  * Message body: "The resource at <arg1> is in a format not recognized by the
  * service."
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index df62230..2254195 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -474,6 +474,27 @@
 
 /**
  * @internal
+ * @brief Formats PropertyValueOutOfRange message into JSON
+ *
+ * See header file for more information
+ * @endinternal
+ */
+nlohmann::json propertyValueOutOfRange(std::string_view arg1,
+                                       std::string_view arg2)
+{
+    return getLog(redfish::registries::base::Index::propertyValueOutOfRange,
+                  std::to_array({arg1, arg2}));
+}
+
+void propertyValueOutOfRange(crow::Response& res, std::string_view arg1,
+                             std::string_view arg2)
+{
+    res.result(boost::beast::http::status::bad_request);
+    addMessageToErrorJson(res.jsonValue, propertyValueOutOfRange(arg1, arg2));
+}
+
+/**
+ * @internal
  * @brief Formats ResourceAtUriInUnknownFormat message into JSON
  *
  * See header file for more information