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/types/collection_time_scope.hpp b/src/types/collection_time_scope.hpp
index 90c4fd3..25e0744 100644
--- a/src/types/collection_time_scope.hpp
+++ b/src/types/collection_time_scope.hpp
@@ -17,6 +17,12 @@
 namespace utils
 {
 
+template <>
+struct EnumTraits<CollectionTimeScope>
+{
+    static constexpr auto propertyName = ConstexprString{"CollectionTimeScope"};
+};
+
 constexpr std::array<std::pair<std::string_view, CollectionTimeScope>, 3>
     convDataCollectionTimeScope = {
         {std::make_pair<std::string_view, CollectionTimeScope>(
diff --git a/src/types/error_type.hpp b/src/types/error_type.hpp
index 0f1d61e..00e9bb1 100644
--- a/src/types/error_type.hpp
+++ b/src/types/error_type.hpp
@@ -17,6 +17,12 @@
 namespace utils
 {
 
+template <>
+struct EnumTraits<ErrorType>
+{
+    static constexpr auto propertyName = ConstexprString{"ErrorType"};
+};
+
 constexpr auto convDataErrorType =
     std::array{std::make_pair<std::string_view, ErrorType>(
         "PropertyConflict", ErrorType::propertyConflict)};
diff --git a/src/types/operation_type.hpp b/src/types/operation_type.hpp
index 6d19620..cca8b23 100644
--- a/src/types/operation_type.hpp
+++ b/src/types/operation_type.hpp
@@ -17,6 +17,12 @@
 namespace utils
 {
 
+template <>
+struct EnumTraits<OperationType>
+{
+    static constexpr auto propertyName = ConstexprString{"OperationType"};
+};
+
 constexpr std::array<std::pair<std::string_view, OperationType>, 4>
     convDataOperationType = {{std::make_pair<std::string_view, OperationType>(
                                   "Maximum", OperationType::max),
diff --git a/src/types/report_action.hpp b/src/types/report_action.hpp
index 44348f2..3a114e3 100644
--- a/src/types/report_action.hpp
+++ b/src/types/report_action.hpp
@@ -16,6 +16,12 @@
 namespace utils
 {
 
+template <>
+struct EnumTraits<ReportAction>
+{
+    static constexpr auto propertyName = ConstexprString{"ReportAction"};
+};
+
 constexpr std::array<std::pair<std::string_view, ReportAction>, 2>
     convDataReportAction = {
         {std::make_pair<std::string_view, ReportAction>(
@@ -40,4 +46,4 @@
     return std::string(enumToString(convDataReportAction, value));
 }
 
-} // namespace utils
\ No newline at end of file
+} // namespace utils
diff --git a/src/types/report_updates.hpp b/src/types/report_updates.hpp
index 2640bf0..8313a94 100644
--- a/src/types/report_updates.hpp
+++ b/src/types/report_updates.hpp
@@ -22,12 +22,7 @@
 template <>
 struct EnumTraits<ReportUpdates>
 {
-    [[noreturn]] static void throwConversionError()
-    {
-        throw sdbusplus::exception::SdBusError(
-            static_cast<int>(std::errc::invalid_argument),
-            "Invalid ReportUpdates");
-    }
+    static constexpr auto propertyName = ConstexprString{"ReportUpdates"};
 };
 
 constexpr auto convDataReportUpdates =
diff --git a/src/types/reporting_type.hpp b/src/types/reporting_type.hpp
index ae0b60a..2c9f500 100644
--- a/src/types/reporting_type.hpp
+++ b/src/types/reporting_type.hpp
@@ -22,12 +22,7 @@
 template <>
 struct EnumTraits<ReportingType>
 {
-    [[noreturn]] static void throwConversionError()
-    {
-        throw sdbusplus::exception::SdBusError(
-            static_cast<int>(std::errc::invalid_argument),
-            "Invalid reportingType");
-    }
+    static constexpr auto propertyName = ConstexprString{"ReportingType"};
 };
 
 constexpr std::array<std::pair<std::string_view, ReportingType>, 3>
diff --git a/src/types/trigger_types.hpp b/src/types/trigger_types.hpp
index 9a053c8..7ba0768 100644
--- a/src/types/trigger_types.hpp
+++ b/src/types/trigger_types.hpp
@@ -177,3 +177,32 @@
         return std::get<std::string>(val);
     }
 }
+
+namespace utils
+{
+
+template <>
+struct EnumTraits<TriggerAction>
+{
+    static constexpr auto propertyName = ConstexprString{"TriggerAction"};
+};
+
+template <>
+struct EnumTraits<discrete::Severity>
+{
+    static constexpr auto propertyName = ConstexprString{"discrete::Severity"};
+};
+
+template <>
+struct EnumTraits<numeric::Type>
+{
+    static constexpr auto propertyName = ConstexprString{"numeric::Type"};
+};
+
+template <>
+struct EnumTraits<numeric::Direction>
+{
+    static constexpr auto propertyName = ConstexprString{"numeric::Direction"};
+};
+
+} // namespace utils