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.cpp b/src/utils/dbus_path_utils.cpp
index 5c1fddb..2eabc86 100644
--- a/src/utils/dbus_path_utils.cpp
+++ b/src/utils/dbus_path_utils.cpp
@@ -51,23 +51,17 @@
     {
         if (pos_start == pos_end)
         {
-            throw sdbusplus::exception::SdBusError(
-                static_cast<int>(std::errc::invalid_argument),
-                "Invalid prefixes in id");
+            throw errors::InvalidArgument("Id", "Invalid prefixes in id.");
         }
 
         if (++prefix_cnt > constants::maxPrefixesInId)
         {
-            throw sdbusplus::exception::SdBusError(
-                static_cast<int>(std::errc::invalid_argument),
-                "Too many prefixes");
+            throw errors::InvalidArgument("Id", "Too many prefixes.");
         }
 
         if (pos_end - pos_start > constants::maxPrefixLength)
         {
-            throw sdbusplus::exception::SdBusError(
-                static_cast<int>(std::errc::invalid_argument),
-                "Prefix too long");
+            throw errors::InvalidArgument("Id", "Prefix too long.");
         }
 
         pos_start = pos_end + 1;
@@ -75,8 +69,7 @@
 
     if (id.length() - pos_start > constants::maxIdNameLength)
     {
-        throw sdbusplus::exception::SdBusError(
-            static_cast<int>(std::errc::invalid_argument), "Id too long");
+        throw errors::InvalidArgument("Id", "Too long.");
     }
 }
 } // namespace utils