Error handling for getkwVal API
This commit updates getKwVal APIs to set error code in case of error.
This helps the caller of API to take action based on the error code
returned from the API.
Change-Id: I884dae49ebc56c57cb41f880dfc796ab53b47d16
Signed-off-by: Rekha Aparna <vrekhaaparna@ibm.com>
diff --git a/vpd-manager/src/backup_restore.cpp b/vpd-manager/src/backup_restore.cpp
index 67829d3..025f738 100644
--- a/vpd-manager/src/backup_restore.cpp
+++ b/vpd-manager/src/backup_restore.cpp
@@ -302,13 +302,14 @@
         if (!io_srcVpdMap.empty())
         {
             l_srcStrValue = vpdSpecificUtility::getKwVal(
-                io_srcVpdMap.at(l_srcRecordName), l_srcKeywordName);
+                io_srcVpdMap.at(l_srcRecordName), l_srcKeywordName, l_errCode);
 
             if (l_srcStrValue.empty())
             {
                 std::runtime_error(
                     std::string("Failed to get value for keyword [") +
-                    l_srcKeywordName + std::string("]"));
+                    l_srcKeywordName + std::string("], error : ") +
+                    commonUtility::getErrCodeMsg(l_errCode));
             }
 
             l_srcBinaryValue =
@@ -334,13 +335,14 @@
         if (!io_dstVpdMap.empty())
         {
             l_dstStrValue = vpdSpecificUtility::getKwVal(
-                io_dstVpdMap.at(l_dstRecordName), l_dstKeywordName);
+                io_dstVpdMap.at(l_dstRecordName), l_dstKeywordName, l_errCode);
 
             if (l_dstStrValue.empty())
             {
                 std::runtime_error(
                     std::string("Failed to get value for keyword [") +
-                    l_dstKeywordName + std::string("]"));
+                    l_dstKeywordName + std::string("], error : ") +
+                    commonUtility::getErrCodeMsg(l_errCode));
             }
 
             l_dstBinaryValue =