Add handling for json utility exception
While handling pass1 planar, handle exceltion in place.
This needs to be removed once utility methods are updated to not throw
exceptions.
Change-Id: I48c9000d6b6f7a0971e5ec21a897498c903a0a72
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/src/worker.cpp b/vpd-manager/src/worker.cpp
index d1bd00c..a0978c8 100644
--- a/vpd-manager/src/worker.cpp
+++ b/vpd-manager/src/worker.cpp
@@ -1453,14 +1453,24 @@
// logging error for these cases.
if (vpdSpecificUtility::isPass1Planar())
{
- const std::string& l_invPathLeafValue =
- sdbusplus::message::object_path(
- jsonUtility::getInventoryObjPathFromJson(m_parsedJson,
- i_vpdFilePath))
- .filename();
+ // Till exceptions are removed from utility method, this needs
+ // to be handled in place.
+ try
+ {
+ const std::string& l_invPathLeafValue =
+ sdbusplus::message::object_path(
+ jsonUtility::getInventoryObjPathFromJson(
+ m_parsedJson, i_vpdFilePath))
+ .filename();
- if ((l_invPathLeafValue.find("pcie_card", 0) !=
- std::string::npos))
+ if ((l_invPathLeafValue.find("pcie_card", 0) !=
+ std::string::npos))
+ {
+ // skip logging any PEL for PCIe cards on pass 1 planar.
+ return std::make_tuple(false, i_vpdFilePath);
+ }
+ }
+ catch (const std::exception& l_ex)
{
// skip logging any PEL for PCIe cards on pass 1 planar.
return std::make_tuple(false, i_vpdFilePath);