From d541027d4bc1f7f0fa00411d5eead606d476dbc2 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Thu, 10 May 2018 11:17:58 -0700 Subject: watchdog_service: Convert runtime errors to internal failures We want to better adhere to the openbmc convention of logging our errors and reporting and internal exception upstack. Change-Id: I78a277ed564b1ac269d84c024b75d2b0f534e911 Signed-off-by: William A. Kennington III --- app/watchdog_service.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/watchdog_service.cpp b/app/watchdog_service.cpp index cf386b8..c95c092 100644 --- a/app/watchdog_service.cpp +++ b/app/watchdog_service.cpp @@ -1,14 +1,23 @@ #include "watchdog_service.hpp" +#include +#include +#include #include #include #include +#include #include #include "host-ipmid/ipmid-api.h" +using phosphor::logging::entry; +using phosphor::logging::elog; +using phosphor::logging::level; +using phosphor::logging::log; using sdbusplus::message::variant_ns::get; using sdbusplus::message::variant_ns::variant; +using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; using sdbusplus::xyz::openbmc_project::State::server::convertForMessage; using sdbusplus::xyz::openbmc_project::State::server::Watchdog; @@ -37,7 +46,8 @@ WatchdogService::Properties WatchdogService::getProperties() // Retry the request once in case the cached service was stale return getProperties(); } - throw std::runtime_error("Failed to get watchdog properties"); + log("WatchdogService: Method error getting properties"); + elog(); } std::map> properties; @@ -67,7 +77,9 @@ void WatchdogService::setProperty(const std::string& key, const T& val) // Retry the request once in case the cached service was stale return setProperty(key, val); } - throw std::runtime_error(std::string("Failed to set property: ") + key); + log("WatchdogService: Method error setting property", + entry("PROPERTY=%s", key.c_str())); + elog(); } } -- cgit v1.2.1