monitor: Allow missing sensors
Don't count sensors that don't exist as nonfunctional. Let some
other application decide if missing sensors are a problem or not.
Change-Id: Ie3d438c92df16bfd86ddc86db8a9dd143bf2cfb0
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/monitor/fan.cpp b/monitor/fan.cpp
index f3937c2..6d88d2a 100644
--- a/monitor/fan.cpp
+++ b/monitor/fan.cpp
@@ -49,13 +49,21 @@
for (auto& s : sensors)
{
- _sensors.emplace_back(
- std::make_unique<TachSensor>(bus,
- *this,
- std::get<sensorNameField>(s),
- std::get<hasTargetField>(s),
- std::get<timeoutField>(def),
- events));
+ try
+ {
+ _sensors.emplace_back(
+ std::make_unique<TachSensor>(
+ bus,
+ *this,
+ std::get<sensorNameField>(s),
+ std::get<hasTargetField>(s),
+ std::get<timeoutField>(def),
+ events));
+ }
+ catch (InvalidSensorError& e)
+ {
+
+ }
}
//Start from a known state of functional