Update json_utility APIs with error codes
This commit updates API getVPDOffset and getInventoryObjPathFromJson to
set error codes in case of errors/exceptions. This helps caller of the
APIs to take action based on the error code returned from the API.
Change-Id: Icfe2640ee311d61e83ca302e5199ce4dd1057c8b
Signed-off-by: Rekha Aparna <vrekhaaparna@ibm.com>
diff --git a/vpd-manager/oem-handler/ibm_handler.cpp b/vpd-manager/oem-handler/ibm_handler.cpp
index 277b499..4b077f5 100644
--- a/vpd-manager/oem-handler/ibm_handler.cpp
+++ b/vpd-manager/oem-handler/ibm_handler.cpp
@@ -212,12 +212,21 @@
// The utility method will handle emty JSON case. No explicit
// handling required here.
+ uint16_t l_errCode = 0;
auto l_inventoryPath = jsonUtility::getInventoryObjPathFromJson(
- l_sysCfgJsonObj, l_fruPath);
+ l_sysCfgJsonObj, l_fruPath, l_errCode);
// Mark it as failed if inventory path not found in JSON.
if (l_inventoryPath.empty())
{
+ if (l_errCode)
+ {
+ logging::logMessage(
+ "Failed to get inventory object path from JSON for FRU [" +
+ l_fruPath + "], error : " +
+ vpdSpecificUtility::getErrCodeMsg(l_errCode));
+ }
+
o_failedPathList.push_back(l_fruPath);
continue;
}