diff options
author | Asmitha Karunanithi <asmitk01@in.ibm.com> | 2024-04-03 14:44:22 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2024-04-09 19:26:52 +0300 |
commit | 1827b4f1de1e42bb3e2f53f584f07bb7119a3ed2 (patch) | |
tree | fde2e6dfec7ff2c7e817717ca2ee3a84baea55c2 /redfish-core/src/error_messages.cpp | |
parent | 6ea9076048028a4adfdbdd2606698bffc81203d3 (diff) | |
download | bmcweb-1827b4f1de1e42bb3e2f53f584f07bb7119a3ed2.tar.xz |
Move to Redfish Action specific setProperty call
This commit will migrate all the setProperty calls initiated by a
redfish"Action" to "setDbusProperty" method in Redfish namespace that
handles all DBuserrors in a consistent manner.
This method will determine if a setProperty is called during redfish
"Action" or just setting of a dbus property and internally call
appropriate methods that handles different set of errors.
All the Redfish action specific errors are defined in error_messages.hpp
file.
This specific change moves setProperty call in hypervisor_system.hpp and
covers errors in the mentioned file only.
Tested-By:
<Yet to test this usecase>
Change-Id: I3da48fbeabcdcf088c4481021232f08a44797c86
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'redfish-core/src/error_messages.cpp')
-rw-r--r-- | redfish-core/src/error_messages.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp index 6c4282cc67..7b0251562d 100644 --- a/redfish-core/src/error_messages.cpp +++ b/redfish-core/src/error_messages.cpp @@ -1453,6 +1453,29 @@ void actionParameterValueTypeError(crow::Response& res, /** * @internal + * @brief Formats actionParameterValueError message into JSON + * + * See header file for more information + * @endinternal + */ +nlohmann::json actionParameterValueError(const nlohmann::json& arg1, + std::string_view arg2) +{ + std::string arg1Str = arg1.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); + return getLog(redfish::registries::base::Index::actionParameterValueError, + std::to_array<std::string_view>({arg1Str, arg2})); +} + +void actionParameterValueError(crow::Response& res, const nlohmann::json& arg1, + std::string_view arg2) +{ + res.result(boost::beast::http::status::bad_request); + addMessageToErrorJson(res.jsonValue, actionParameterValueError(arg1, arg2)); +} + +/** + * @internal * @brief Formats SessionLimitExceeded message into JSON * * See header file for more information |