Error code for encodeKeyword API

This commit updates encodeKeyword 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: I0cba6191d2ec6ded8e793514086f3e62218cf893
Signed-off-by: Rekha Aparna <vrekhaaparna@ibm.com>
diff --git a/wait-vpd-parser/src/prime_inventory.cpp b/wait-vpd-parser/src/prime_inventory.cpp
index 2dab4bb..137231b 100644
--- a/wait-vpd-parser/src/prime_inventory.cpp
+++ b/wait-vpd-parser/src/prime_inventory.cpp
@@ -302,6 +302,8 @@
                 const std::string& l_encoding =
                     l_propValuePair.value().value("encoding", "");
 
+                uint16_t l_errCode = 0;
+
                 if (auto l_ipzVpdMap =
                         std::get_if<vpd::types::IPZVpdMap>(&i_parsedVpdMap))
                 {
@@ -311,7 +313,16 @@
                     {
                         auto l_encoded = vpd::vpdSpecificUtility::encodeKeyword(
                             ((*l_ipzVpdMap).at(l_record).at(l_keyword)),
-                            l_encoding);
+                            l_encoding, l_errCode);
+
+                        if (l_errCode)
+                        {
+                            m_logger->logMessage(
+                                "Failed to get encoded keyword value for : " +
+                                l_keyword + ", error : " +
+                                vpd::commonUtility::getErrCodeMsg(l_errCode));
+                        }
+
                         l_propertyMap.emplace(l_property, l_encoded);
                     }
                 }
@@ -329,7 +340,16 @@
                                 vpd::vpdSpecificUtility::encodeKeyword(
                                     std::string((*l_kwValue).begin(),
                                                 (*l_kwValue).end()),
-                                    l_encoding);
+                                    l_encoding, l_errCode);
+
+                            if (l_errCode)
+                            {
+                                m_logger->logMessage(
+                                    "Failed to get encoded keyword value for : " +
+                                    l_keyword + ", error : " +
+                                    vpd::commonUtility::getErrCodeMsg(
+                                        l_errCode));
+                            }
 
                             l_propertyMap.emplace(l_property, l_encodedValue);
                         }
@@ -340,7 +360,16 @@
                                 vpd::vpdSpecificUtility::encodeKeyword(
                                     std::string((*l_kwValue).begin(),
                                                 (*l_kwValue).end()),
-                                    l_encoding);
+                                    l_encoding, l_errCode);
+
+                            if (l_errCode)
+                            {
+                                m_logger->logMessage(
+                                    "Failed to get encoded keyword value for : " +
+                                    l_keyword + ", error : " +
+                                    vpd::commonUtility::getErrCodeMsg(
+                                        l_errCode));
+                            }
 
                             l_propertyMap.emplace(l_property, l_encodedValue);
                         }