Romulus: Handle SdBusError Exceptions
Handle exceptions from the sdbusplus method call_noreply API.
The phosphor-fru-fault-monitor app would fail with the following
message on Romulus with the latest sdbusplus changes:
sd_bus_call noreply: org.freedesktop.DBus.Error.UnknownObject:
Unknown object '/xyz/openbmc_project/led/groups/core1_fault'.
Add error handling.
Tested: The phosphor-fru-fault-monitor does not core dump on Romulus.
Change-Id: I2bec59c0e0f483e8bfc0cb20a343cb05670212b7
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
index 6771b08..158389f 100644
--- a/fault-monitor/fru-fault-monitor.cpp
+++ b/fault-monitor/fru-fault-monitor.cpp
@@ -138,7 +138,17 @@
method.append("Asserted");
method.append(sdbusplus::message::variant<bool>(assert));
- bus.call_noreply(method);
+
+ try
+ {
+ bus.call_noreply(method);
+ }
+ catch (const sdbusplus::exception::SdBusError& e)
+ {
+ // Log an info message, system may not have all the LED Groups defined
+ log<level::INFO>("Failed to Assert LED Group",
+ entry("ERROR=%s", e.what()));
+ }
return;
}