lamp test: Fix calling GetSubTreePaths method
The caller should catch the exception when calling the
GetSubTreePaths method to prevent the process coredump
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I5bd8adb6191fa7f61dabd8be18b1753f4c65c2c5
diff --git a/manager/lamptest/lamptest.cpp b/manager/lamptest/lamptest.cpp
index 5fd430c..d90fc8a 100644
--- a/manager/lamptest/lamptest.cpp
+++ b/manager/lamptest/lamptest.cpp
@@ -172,7 +172,18 @@
}
// Get paths of all the Physical LED objects
- physicalLEDPaths = dBusHandler.getSubTreePaths(PHY_LED_PATH, PHY_LED_IFACE);
+ try
+ {
+ physicalLEDPaths = dBusHandler.getSubTreePaths(PHY_LED_PATH,
+ PHY_LED_IFACE);
+ }
+ catch (const sdbusplus::exception_t& e)
+ {
+ lg2::error(
+ "Failed to call the SubTreePaths method: {ERROR}, ledPath: {PATH}, ledInterface: {INTERFACE}",
+ "ERROR", e, "PATH", PHY_LED_PATH, "INTERFACE", PHY_LED_IFACE);
+ return;
+ }
// Get physical LEDs states before lamp test
storePhysicalLEDsStates();