summaryrefslogtreecommitdiffstats
path: root/control
diff options
context:
space:
mode:
Diffstat (limited to 'control')
-rw-r--r--control/functor.hpp6
-rw-r--r--control/main.cpp44
-rw-r--r--control/matches.hpp4
-rw-r--r--control/zone.cpp2
4 files changed, 36 insertions, 20 deletions
diff --git a/control/functor.hpp b/control/functor.hpp
index 0a2b955..2ca047c 100644
--- a/control/functor.hpp
+++ b/control/functor.hpp
@@ -15,8 +15,6 @@ class Zone;
using namespace phosphor::fan;
using namespace sdbusplus::bus::match;
using namespace phosphor::logging;
-using InternalFailure = sdbusplus::xyz::openbmc_project::Common::
- Error::InternalFailure;
/**
* @brief Create a handler function object
@@ -115,7 +113,7 @@ struct PropertyChanged
_property);
_handler(zone, std::forward<T>(val));
}
- catch (const InternalFailure& ife)
+ catch (const util::DBusError& e)
{
// Property will not be used unless a property changed
// signal message is received for this property.
@@ -397,7 +395,7 @@ struct NameOwnerChanged
"NameHasOwner",
name);
}
- catch (const InternalFailure& ife)
+ catch (const util::DBusMethodError& e)
{
// Failed to get service name owner state
hasOwner = false;
diff --git a/control/main.cpp b/control/main.cpp
index cde71d0..dd9330d 100644
--- a/control/main.cpp
+++ b/control/main.cpp
@@ -18,6 +18,7 @@
#include "argument.hpp"
#include "manager.hpp"
#include "event.hpp"
+#include "sdbusplus.hpp"
using namespace phosphor::fan::control;
using namespace phosphor::logging;
@@ -64,22 +65,41 @@ int main(int argc, char* argv[])
//handle both sd_events (for the timers) and dbus signals.
bus.attach_event(eventPtr.get(), SD_EVENT_PRIORITY_NORMAL);
- Manager manager(bus, eventPtr, mode);
+ try
+ {
+ Manager manager(bus, eventPtr, mode);
- //Init mode will just set fans to max and delay
- if (mode == Mode::init)
+ //Init mode will just set fans to max and delay
+ if (mode == Mode::init)
+ {
+ manager.doInit();
+ return 0;
+ }
+ else
+ {
+ r = sd_event_loop(eventPtr.get());
+ if (r < 0)
+ {
+ log<level::ERR>("Failed call to sd_event_loop",
+ entry("ERROR=%s", strerror(-r)));
+ }
+ }
+ }
+ //Log the useful metadata on these exceptions and let the app
+ //return -1 so it is restarted without a core dump.
+ catch (phosphor::fan::util::DBusServiceError& e)
{
- manager.doInit();
- return 0;
+ log<level::ERR>("Uncaught DBus service lookup failure exception",
+ entry("PATH=%s", e.path.c_str()),
+ entry("INTERFACE=%s", e.interface.c_str()));
}
- else
+ catch (phosphor::fan::util::DBusMethodError& e)
{
- r = sd_event_loop(eventPtr.get());
- if (r < 0)
- {
- log<level::ERR>("Failed call to sd_event_loop",
- entry("ERROR=%s", strerror(-r)));
- }
+ log<level::ERR>("Uncaught DBus method failure exception",
+ entry("BUSNAME=%s", e.busName.c_str()),
+ entry("PATH=%s", e.path.c_str()),
+ entry("INTERFACE=%s", e.interface.c_str()),
+ entry("METHOD=%s", e.method.c_str()));
}
return -1;
diff --git a/control/matches.hpp b/control/matches.hpp
index ccacbc4..c3b4006 100644
--- a/control/matches.hpp
+++ b/control/matches.hpp
@@ -14,8 +14,6 @@ namespace match
using namespace phosphor::fan;
using namespace sdbusplus::bus::match;
-using InternalFailure = sdbusplus::xyz::openbmc_project::Common::
- Error::InternalFailure;
/**
* @brief A match function that constructs a PropertiesChanged match string
@@ -77,7 +75,7 @@ inline auto nameOwnerChanged(const std::string& obj, const std::string& iface)
{
noc = rules::nameOwnerChanged(util::SDBusPlus::getService(obj, iface));
}
- catch (const InternalFailure& ife)
+ catch (const util::DBusError& e)
{
// Unable to construct NameOwnerChanged match string
}
diff --git a/control/zone.cpp b/control/zone.cpp
index 325a5b8..f4c50d9 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -196,7 +196,7 @@ void Zone::setServices(const Group* group)
"NameHasOwner",
name);
}
- catch (const InternalFailure& ife)
+ catch (const util::DBusMethodError& e)
{
// Failed to get service name owner state
hasOwner = false;
OpenPOWER on IntegriCloud