summaryrefslogtreecommitdiffstats
path: root/control/fan.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-07-17 10:51:36 -0500
committerMatthew Barth <msbarth@us.ibm.com>2018-07-17 10:51:36 -0500
commit86be476bfb6acfd413afff449a357123639eb29e (patch)
tree4f4f2f24500a4e54e01bdec5b6a392eb59ffdda7 /control/fan.cpp
parentb0de1d6a88cee65cfc1041d26e04ac443ca1af4a (diff)
downloadphosphor-fan-presence-86be476bfb6acfd413afff449a357123639eb29e.tar.gz
phosphor-fan-presence-86be476bfb6acfd413afff449a357123639eb29e.zip
Handle SdBusError exceptions
When the SdBusError exception was added, all sdbusplus::bus::call function use required this exception be handled appropriately in each case where it could occur. These changes are the result of handling the possibility of this exception correctly within the fan applications. Change-Id: I6ecef3008412b299a4fedbb13716f656cfbf1a90 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/fan.cpp')
-rw-r--r--control/fan.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/control/fan.cpp b/control/fan.cpp
index d4303cf..c86186f 100644
--- a/control/fan.cpp
+++ b/control/fan.cpp
@@ -65,13 +65,25 @@ void Fan::setSpeed(uint64_t speed)
for (auto& sensor : _sensors)
{
auto value = speed;
- util::SDBusPlus::setProperty<uint64_t>(
- _bus,
- sensor.second,
- sensor.first,
- _interface,
- FAN_TARGET_PROPERTY,
- std::move(value));
+ try
+ {
+ util::SDBusPlus::setProperty<uint64_t>(
+ _bus,
+ sensor.second,
+ sensor.first,
+ _interface,
+ FAN_TARGET_PROPERTY,
+ std::move(value));
+ }
+ catch (const sdbusplus::exception::SdBusError&)
+ {
+ throw util::DBusPropertyError{
+ "DBus set property failed",
+ sensor.second,
+ sensor.first,
+ _interface,
+ FAN_TARGET_PROPERTY};
+ }
}
_targetSpeed = speed;
OpenPOWER on IntegriCloud