summaryrefslogtreecommitdiff
path: root/redfish-core/scripts/error_messages
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2018-05-23 01:27:24 +0300
committerEd Tanous <ed.tanous@intel.com>2018-07-27 01:54:37 +0300
commit55c7b7a2e58779580f33046d2dd8649243776700 (patch)
treeeed2d032dff3e18c4a8d4778e8f52ae5864620ee /redfish-core/scripts/error_messages
parent1752c9657b56a6e1950d8725f44f4298c9872c63 (diff)
downloadbmcweb-55c7b7a2e58779580f33046d2dd8649243776700.tar.xz
Move over to upstream c++ style
This patchset moves bmcweb over to the upstream style naming conventions for variables, classes, and functions, as well as imposes the latest clang-format file. This changeset was mostly built automatically by the included .clang-tidy file, which has the ability to autoformat and auto rename variables. At some point in the future I would like to see this in greater use, but for now, we will impose it on bmcweb, and see how it goes. Tested: Code still compiles, and appears to run, although other issues are possible and likely. Change-Id: If422a2e36df924e897736b3feffa89f411d9dac1 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'redfish-core/scripts/error_messages')
-rw-r--r--redfish-core/scripts/error_messages/error_messages.cpp.in16
-rw-r--r--redfish-core/scripts/error_messages/error_messages.hpp.in4
2 files changed, 10 insertions, 10 deletions
diff --git a/redfish-core/scripts/error_messages/error_messages.cpp.in b/redfish-core/scripts/error_messages/error_messages.cpp.in
index a254b08c72..01b82a58ce 100644
--- a/redfish-core/scripts/error_messages/error_messages.cpp.in
+++ b/redfish-core/scripts/error_messages/error_messages.cpp.in
@@ -29,13 +29,13 @@ void addMessageToErrorJson(nlohmann::json& target,
if (!error.is_object()) {
auto message_id_iterator = message.find("MessageId");
if (message_id_iterator == message.end()) {
- CROW_LOG_CRITICAL << "Attempt to add error message without MessageId";
+ BMCWEB_LOG_CRITICAL << "Attempt to add error message without MessageId";
return;
}
auto message_field_iterator = message.find("Message");
if (message_field_iterator == message.end()) {
- CROW_LOG_CRITICAL << "Attempt to add error message without Message";
+ BMCWEB_LOG_CRITICAL << "Attempt to add error message without Message";
return;
}
// clang-format off
@@ -46,7 +46,7 @@ void addMessageToErrorJson(nlohmann::json& target,
// clang-format on
} else {
// More than 1 error occurred, so the message has to be generic
- error["code"] = std::string(MESSAGE_VERSION_PREFIX) + "GeneralError";
+ error["code"] = std::string(messageVersionPrefix) + "GeneralError";
error["message"] = "A general error has occurred. See ExtendedInfo for more"
"information.";
}
@@ -54,7 +54,7 @@ void addMessageToErrorJson(nlohmann::json& target,
// This check could technically be done in in the default construction
// branch above, but because we need the pointer to the extended info field
// anyway, it's more efficient to do it here.
- auto& extended_info = error[messages::MESSAGE_ANNOTATION];
+ auto& extended_info = error[messages::messageAnnotation];
if (!extended_info.is_array()) {
extended_info = nlohmann::json::array();
}
@@ -64,17 +64,17 @@ void addMessageToErrorJson(nlohmann::json& target,
void addMessageToJsonRoot(nlohmann::json& target,
const nlohmann::json& message) {
- if (!target[messages::MESSAGE_ANNOTATION].is_array()) {
+ if (!target[messages::messageAnnotation].is_array()) {
// Force object to be an array
- target[messages::MESSAGE_ANNOTATION] = nlohmann::json::array();
+ target[messages::messageAnnotation] = nlohmann::json::array();
}
- target[messages::MESSAGE_ANNOTATION].push_back(message);
+ target[messages::messageAnnotation].push_back(message);
}
void addMessageToJson(nlohmann::json& target, const nlohmann::json& message,
const std::string& fieldPath) {
- nlohmann::json_pointer extendedInfo(fieldPath + messages::MESSAGE_ANNOTATION);
+ nlohmann::json_pointer extendedInfo(fieldPath + messages::messageAnnotation);
if (!target[extendedInfo].is_array()) {
// Force object to be an array
diff --git a/redfish-core/scripts/error_messages/error_messages.hpp.in b/redfish-core/scripts/error_messages/error_messages.hpp.in
index 287917df97..b0f5c009d9 100644
--- a/redfish-core/scripts/error_messages/error_messages.hpp.in
+++ b/redfish-core/scripts/error_messages/error_messages.hpp.in
@@ -28,8 +28,8 @@ namespace redfish {
namespace messages {
-constexpr const char* MESSAGE_VERSION_PREFIX = "Base.1.2.0.";
-constexpr const char* MESSAGE_ANNOTATION = "@Message.ExtendedInfo";
+constexpr const char* messageVersionPrefix = "Base.1.2.0.";
+constexpr const char* messageAnnotation = "@Message.ExtendedInfo";
/**
* @brief Adds Message JSON object to error object