summaryrefslogtreecommitdiffstats
path: root/sdbusplus.hpp
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 /sdbusplus.hpp
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 'sdbusplus.hpp')
-rw-r--r--sdbusplus.hpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/sdbusplus.hpp b/sdbusplus.hpp
index 3a6cd65..41c7fe2 100644
--- a/sdbusplus.hpp
+++ b/sdbusplus.hpp
@@ -149,14 +149,19 @@ class SDBusPlus
interface.c_str(),
method.c_str());
reqMsg.append(std::forward<Args>(args)...);
- auto respMsg = bus.call(reqMsg);
-
- if (respMsg.is_method_error())
+ try
+ {
+ auto respMsg = bus.call(reqMsg);
+ if (respMsg.is_method_error())
+ {
+ throw DBusMethodError{busName, path, interface, method};
+ }
+ return respMsg;
+ }
+ catch (const sdbusplus::exception::SdBusError&)
{
throw DBusMethodError{busName, path, interface, method};
}
-
- return respMsg;
}
/** @brief Invoke a method. */
OpenPOWER on IntegriCloud