summaryrefslogtreecommitdiffstats
path: root/monitor
diff options
context:
space:
mode:
authorDinesh Chinari <chinari@us.ibm.com>2017-06-26 23:26:50 -0500
committerDinesh Chinari <chinari@us.ibm.com>2017-06-28 08:16:18 -0500
commit618027abcf491b0b58f71bfe2b48c55dfb86462e (patch)
tree358d628f65ba2b426210d837681baa287b869603 /monitor
parentbb12c926dca2215bccfbd270da11f0c2b5822878 (diff)
downloadphosphor-fan-presence-618027abcf491b0b58f71bfe2b48c55dfb86462e.tar.gz
phosphor-fan-presence-618027abcf491b0b58f71bfe2b48c55dfb86462e.zip
phosphor-fan-presence elog error exception.
Implemented elog exception for phosphor fan presence, replacing runtime_errors. Change-Id: I70465060838b2cbaeadccf84ed5924e222ac59e3 Signed-off-by: Dinesh Chinari <chinari@us.ibm.com>
Diffstat (limited to 'monitor')
-rw-r--r--monitor/Makefile.am6
-rw-r--r--monitor/fan.cpp10
-rw-r--r--monitor/tach_sensor.cpp13
3 files changed, 15 insertions, 14 deletions
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<level::ERR>(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 <phosphor-logging/log.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
#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<level::ERR>("Error in property get call",
+ entry("PATH=%s", path.c_str()));
+ elog<InternalFailure>();
}
reply.read(property);
OpenPOWER on IntegriCloud