summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-05-10 11:17:58 -0700
committerEmily Shaffer <emilyshaffer@google.com>2018-05-22 18:21:55 +0000
commitd541027d4bc1f7f0fa00411d5eead606d476dbc2 (patch)
tree15242870cb2d4840343b78a74a6857930efccc5e /app
parent021b4c1a00e83699da844c6b641fca2066e29732 (diff)
downloadphosphor-host-ipmid-d541027d4bc1f7f0fa00411d5eead606d476dbc2.tar.gz
phosphor-host-ipmid-d541027d4bc1f7f0fa00411d5eead606d476dbc2.zip
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 <wak@google.com>
Diffstat (limited to 'app')
-rw-r--r--app/watchdog_service.cpp16
1 files changed, 14 insertions, 2 deletions
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 <phosphor-logging/elog.hpp>
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/message.hpp>
#include <string>
+#include <xyz/openbmc_project/Common/error.hpp>
#include <xyz/openbmc_project/State/Watchdog/server.hpp>
#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<level::ERR>("WatchdogService: Method error getting properties");
+ elog<InternalFailure>();
}
std::map<std::string, variant<bool, uint64_t, std::string>> 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<level::ERR>("WatchdogService: Method error setting property",
+ entry("PROPERTY=%s", key.c_str()));
+ elog<InternalFailure>();
}
}
OpenPOWER on IntegriCloud