API to get error type and error msg
Error type to be set should be strictly dependent on the type of
exception being caught. So that correct interface can be called from
message registry while logging a PEL.
Also, the error message logged should have a uniform format across
different kind of errors.
The commit implements API to get the pre-defined error type and message
format for a given exception.
The user needs to call this API and need not set error type on wish.
Change-Id: I3aeddd2986f12ff18b3a061533490db20ebede34
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/src/worker.cpp b/vpd-manager/src/worker.cpp
index 4bd61bf..6506aba 100644
--- a/vpd-manager/src/worker.cpp
+++ b/vpd-manager/src/worker.cpp
@@ -1704,11 +1704,11 @@
catch (const std::exception& l_ex)
{
EventLogger::createSyncPel(
- types::ErrorType::InvalidVpdMessage,
- types::SeverityType::Informational, __FILE__, __FUNCTION__, 0,
+ EventLogger::getErrorType(l_ex), types::SeverityType::Informational,
+ __FILE__, __FUNCTION__, 0,
std::string(
"Exception caught while backup and restore VPD keyword's.") +
- l_ex.what(),
+ EventLogger::getErrorMsg(l_ex),
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
}
}