From 618027abcf491b0b58f71bfe2b48c55dfb86462e Mon Sep 17 00:00:00 2001 From: Dinesh Chinari Date: Mon, 26 Jun 2017 23:26:50 -0500 Subject: phosphor-fan-presence elog error exception. Implemented elog exception for phosphor fan presence, replacing runtime_errors. Change-Id: I70465060838b2cbaeadccf84ed5924e222ac59e3 Signed-off-by: Dinesh Chinari --- monitor/Makefile.am | 6 ++++-- monitor/fan.cpp | 10 +--------- monitor/tach_sensor.cpp | 13 ++++++++++--- 3 files changed, 15 insertions(+), 14 deletions(-) (limited to 'monitor') diff --git a/monitor/Makefile.am b/monitor/Makefile.am index f54248e..7b5fdae 100644 --- a/monitor/Makefile.am +++ b/monitor/Makefile.am @@ -17,11 +17,13 @@ BUILT_SOURCES = fan_monitor_defs.cpp phosphor_fan_monitor_LDADD = \ $(top_builddir)/libfan.la \ $(SDBUSPLUS_LIBS) \ - $(PHOSPHOR_LOGGING_LIBS) + $(PHOSPHOR_LOGGING_LIBS) \ + ${PHOSPHOR_DBUS_INTERFACES_LIBS} phosphor_fan_monitor_CXXFLAGS = \ $(SDBUSPLUS_CFLAGS) \ - $(PHOSPHOR_LOGGING_CFLAGS) + $(PHOSPHOR_LOGGING_CFLAGS) \ + ${PHOSPHOR_DBUS_INTERFACES_CFLAGS} fan_monitor_defs.cpp: ${srcdir}/gen-fan-monitor-defs.py $(AM_V_GEN)$(GEN_FAN_MONITOR_DEFS) diff --git a/monitor/fan.cpp b/monitor/fan.cpp index 17f5812..195317c 100644 --- a/monitor/fan.cpp +++ b/monitor/fan.cpp @@ -199,15 +199,7 @@ void Fan::updateInventory(bool functional) ObjectMap objectMap = getObjectMap(functional); std::string service; - try - { - service = phosphor::fan::util::getInvService(_bus); - } - catch (const std::runtime_error& err) - { - log(err.what()); - return; - } + service = phosphor::fan::util::getInvService(_bus); auto msg = _bus.new_method_call(service.c_str(), INVENTORY_PATH, diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp index 80eb974..2ece054 100644 --- a/monitor/tach_sensor.cpp +++ b/monitor/tach_sensor.cpp @@ -14,6 +14,9 @@ * limitations under the License. */ #include +#include +#include +#include #include "fan.hpp" #include "tach_sensor.hpp" #include "../utility.hpp" @@ -25,6 +28,10 @@ namespace fan namespace monitor { +using namespace phosphor::logging; +using InternalFailure = sdbusplus::xyz::openbmc_project::Common:: + Error::InternalFailure; + constexpr auto PROPERTY_INTF = "org.freedesktop.DBus.Properties"; constexpr auto FAN_SENSOR_PATH = "/xyz/openbmc_project/sensors/fan_tach/"; constexpr auto FAN_SENSOR_CONTROL_INTF = "xyz.openbmc_project.Control.FanSpeed"; @@ -65,9 +72,9 @@ static void readProperty(const std::string& interface, auto reply = bus.call(method); if (reply.is_method_error()) { - throw std::runtime_error( - "Error in property get call for path " + - path); + log("Error in property get call", + entry("PATH=%s", path.c_str())); + elog(); } reply.read(property); -- cgit v1.2.1