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 --- utility.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'utility.cpp') diff --git a/utility.cpp b/utility.cpp index 2cfeac8..7da1557 100644 --- a/utility.cpp +++ b/utility.cpp @@ -25,6 +25,10 @@ namespace util using namespace std::string_literals; +using namespace phosphor::logging; +using InternalFailure = sdbusplus::xyz::openbmc_project::Common:: + Error::InternalFailure; + //TODO Should get these from phosphor-objmgr config.h constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper"; constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper"; @@ -55,8 +59,10 @@ std::string getService(const std::string& path, auto mapperResponseMsg = bus.call(mapperCall); if (mapperResponseMsg.is_method_error()) { - throw std::runtime_error( - "Error in mapper call to get service name"); + log("Error in mapper call to get service name", + entry("PATH=%s", path.c_str()), + entry("INTERFACE=%s", interface.c_str())); + elog(); } @@ -65,8 +71,11 @@ std::string getService(const std::string& path, if (mapperResponse.empty()) { - throw std::runtime_error( - "Error in mapper response for getting service name"); + log( + "Error in mapper response for getting service name", + entry("PATH=%s", path.c_str()), + entry("INTERFACE=%s", interface.c_str())); + elog(); } return mapperResponse.begin()->first; -- cgit v1.2.1