Set error code for isFruPowerOffOnly API

This commit updates isFruPowerOffOnly API to set error code in case of
error. This helps caller of API to take action based on the error code
returned from the API.

Change-Id: Ieb5b0a649ed802cc08ad836bc7399d3dacec9429
Signed-off-by: Rekha Aparna <vrekhaaparna@ibm.com>
diff --git a/vpd-manager/src/worker.cpp b/vpd-manager/src/worker.cpp
index 15f5a0e..c2f9621 100644
--- a/vpd-manager/src/worker.cpp
+++ b/vpd-manager/src/worker.cpp
@@ -1550,12 +1550,22 @@
     {
         // If chassis is powered on, skip collecting FRUs which are
         // powerOffOnly.
-        if (jsonUtility::isFruPowerOffOnly(m_parsedJson, i_vpdFilePath))
+
+        uint16_t l_errCode = 0;
+        if (jsonUtility::isFruPowerOffOnly(m_parsedJson, i_vpdFilePath,
+                                           l_errCode))
         {
             return true;
         }
+        else if (l_errCode)
+        {
+            logging::logMessage(
+                "Failed to check if FRU is power off only for FRU [" +
+                i_vpdFilePath +
+                "], error : " + vpdSpecificUtility::getErrCodeMsg(l_errCode));
+        }
 
-        uint16_t l_errCode = 0;
+        l_errCode = 0;
         std::string l_invPath = jsonUtility::getInventoryObjPathFromJson(
             m_parsedJson, i_vpdFilePath, l_errCode);