Continue execution on any GPIO exception

In case there is any issue with reading of presence GPIO, the code
should check if the required EEPROM file exists.
If found and can be parsed then instead of exiting collection for the
FRU, the code will log an informational PEL for the error and will
continue with the execution.
This is required so that we don't exit collection for an intermediate
error when the collection can be successfully done.

Change-Id: I889668a0e765cc6df7e5df174c7a80c133892d18
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/src/event_logger.cpp b/vpd-manager/src/event_logger.cpp
index c59c8ba..d5bf3d2 100644
--- a/vpd-manager/src/event_logger.cpp
+++ b/vpd-manager/src/event_logger.cpp
@@ -29,6 +29,7 @@
 const std::unordered_map<types::ErrorType, std::string>
     EventLogger::m_errorMsgMap = {
         {types::ErrorType::DefaultValue, "com.ibm.VPD.Error.DefaultValue"},
+        {types::ErrorType::UndefinedError, "com.ibm.VPD.Error.UndefinedError"},
         {types::ErrorType::InvalidVpdMessage, "com.ibm.VPD.Error.InvalidVPD"},
         {types::ErrorType::VpdMismatch, "com.ibm.VPD.Error.Mismatch"},
         {types::ErrorType::InvalidEeprom,
@@ -305,7 +306,7 @@
     const std::exception& i_exception)
 {
     types::ExceptionDataMap l_errorInfo{
-        {"ErrorType", types::ErrorType::FirmwareError},
+        {"ErrorType", types::ErrorType::UndefinedError},
         {"ErrorMsg", i_exception.what()}};
 
     try
@@ -367,6 +368,14 @@
             l_errorInfo["ErrorMsg"] =
                 std::string("Eeprom Exception. Reason: ") + i_exception.what();
         }
+        else if (typeid(i_exception) == typeid(std::runtime_error))
+        {
+            // Since it is a standard exception no casting is required and error
+            // type is hardcoded.
+            l_errorInfo["ErrorType"] = types::ErrorType::FirmwareError;
+            l_errorInfo["ErrorMsg"] =
+                std::string("Eeprom Exception. Reason: ") + i_exception.what();
+        }
     }
     catch (const std::exception& l_ex)
     {
@@ -383,14 +392,14 @@
     auto l_itrToErrType = l_exceptionDataMap.find("ErrorType");
     if (l_itrToErrType == l_exceptionDataMap.end())
     {
-        return types::ErrorType::FirmwareError;
+        return types::ErrorType::UndefinedError;
     }
 
     auto l_ptrToErrType =
         std::get_if<types::ErrorType>(&l_itrToErrType->second);
     if (!l_ptrToErrType)
     {
-        return types::ErrorType::FirmwareError;
+        return types::ErrorType::UndefinedError;
     }
 
     return *l_ptrToErrType;