diff options
author | Dinesh Chinari <chinari@us.ibm.com> | 2017-06-26 23:26:50 -0500 |
---|---|---|
committer | Dinesh Chinari <chinari@us.ibm.com> | 2017-06-28 08:16:18 -0500 |
commit | 618027abcf491b0b58f71bfe2b48c55dfb86462e (patch) | |
tree | 358d628f65ba2b426210d837681baa287b869603 /timer.cpp | |
parent | bb12c926dca2215bccfbd270da11f0c2b5822878 (diff) | |
download | phosphor-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 'timer.cpp')
-rw-r--r-- | timer.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -15,6 +15,9 @@ */ #include <chrono> #include <phosphor-logging/log.hpp> +#include <phosphor-logging/elog.hpp> +#include <phosphor-logging/elog-errors.hpp> +#include <xyz/openbmc_project/Common/error.hpp> #include <type_traits> #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<void()> callbackFunc) : @@ -47,8 +52,7 @@ Timer::Timer(phosphor::fan::event::EventPtr& events, { log<level::ERR>("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<InternalFailure>(); } eventSource.reset(source); @@ -97,8 +101,7 @@ void Timer::setTimer(int action) log<level::ERR>("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<InternalFailure>(); } } @@ -119,8 +122,7 @@ bool Timer::running() { log<level::ERR>("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<InternalFailure>(); } return (status != SD_EVENT_OFF); @@ -145,8 +147,7 @@ void Timer::setTimeout() { log<level::ERR>("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<InternalFailure>(); } } |