sensor-monitor: Catch sdbusplus::exception
Check for a threshold alarm D-Bus property fail read by looking for an
sdbusplus exception instead of one of the built in fan exceptions.
The SdBusPlus wrapper call used here to get the property doesn't throw
any of the fan custom exceptions, and there are cases when the call can
fail, like when entity-manager only defines a high threshold and not a
low one for a sensor so the low alarm property won't be on D-Bus.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I19332603a373436f68ba075844fa3436787ef8b0
diff --git a/sensor-monitor/threshold_alarm_logger.cpp b/sensor-monitor/threshold_alarm_logger.cpp
index 69ecb10..d64366b 100644
--- a/sensor-monitor/threshold_alarm_logger.cpp
+++ b/sensor-monitor/threshold_alarm_logger.cpp
@@ -224,12 +224,11 @@
createEventLog(sensorPath, interface, property, alarmValue);
}
}
- catch (const DBusError& e)
+ catch (const sdbusplus::exception::exception& e)
{
- log<level::ERR>(
- fmt::format("Failed reading sensor threshold properties: {}",
- e.what())
- .c_str());
+ // Sensor daemons that get their direction from entity manager
+ // may only be putting either the high alarm or low alarm on
+ // D-Bus, not both.
continue;
}
}