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 --- timer.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'timer.cpp') diff --git a/timer.cpp b/timer.cpp index d371c98..6929717 100644 --- a/timer.cpp +++ b/timer.cpp @@ -15,6 +15,9 @@ */ #include #include +#include +#include +#include #include #include "timer.hpp" @@ -26,6 +29,8 @@ namespace util { using namespace phosphor::logging; +using InternalFailure = sdbusplus::xyz::openbmc_project::Common:: + Error::InternalFailure; Timer::Timer(phosphor::fan::event::EventPtr& events, std::function callbackFunc) : @@ -47,8 +52,7 @@ Timer::Timer(phosphor::fan::event::EventPtr& events, { log("Timer::Timer failed call to sd_event_add_time", entry("ERROR=%s", strerror(-r))); - //TODO openbmc/openbmc#1555 throw an elog - throw std::runtime_error("Timer initialization failed"); + elog(); } eventSource.reset(source); @@ -97,8 +101,7 @@ void Timer::setTimer(int action) log("Failed call to sd_event_source_set_enabled", entry("ERROR=%s", strerror(-r)), entry("ACTION=%d", action)); - //TODO openbmc/openbmc#1555 throw an elog - throw std::runtime_error("Failed call to sd_event_source_set_enabled"); + elog(); } } @@ -119,8 +122,7 @@ bool Timer::running() { log("Failed call to sd_event_source_get_enabled", entry("ERROR=%s", strerror(-r))); - //TODO openbmc/openbmc#1555 throw an elog - throw std::runtime_error("Failed call to sd_event_source_get_enabled"); + elog(); } return (status != SD_EVENT_OFF); @@ -145,8 +147,7 @@ void Timer::setTimeout() { log("Failed call to sd_event_source_set_time", entry("ERROR=%s", strerror(-r))); - //TODO openbmc/openbmc#1555 throw an elog - throw std::runtime_error("Failed call to sd_event_source_set_time"); + elog(); } } -- cgit v1.2.1