Redesigned error handling
Current error handling send only error code, which is not enough to
display detailed information. New error handling in additional to
error code send property name. This allows to send meaningful messages
back to used about errors.
Tested:
- Old redfish code properly handles errors (reads only error_code)
- Redfish version which read property name from error displays more
detailed error information
Change-Id: I54caa20881ac3f3e38cb295a3aa95ddab491303f
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/src/utils/dbus_path_utils.hpp b/src/utils/dbus_path_utils.hpp
index 3798d98..c1bda62 100644
--- a/src/utils/dbus_path_utils.hpp
+++ b/src/utils/dbus_path_utils.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include "errors.hpp"
+
#include <sdbusplus/message.hpp>
#include <algorithm>
@@ -53,9 +55,7 @@
if (id.find_first_not_of(utils::constants::allowedCharactersInPath) !=
std::string::npos)
{
- throw sdbusplus::exception::SdBusError(
- static_cast<int>(std::errc::invalid_argument),
- "Invalid character in id");
+ throw errors::InvalidArgument("Id", "Invalid character.");
}
}