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>
diff --git a/utility.cpp b/utility.cpp
index 2cfeac8..7da1557 100644
--- a/utility.cpp
+++ b/utility.cpp
@@ -25,6 +25,10 @@
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 @@
auto mapperResponseMsg = bus.call(mapperCall);
if (mapperResponseMsg.is_method_error())
{
- throw std::runtime_error(
- "Error in mapper call to get service name");
+ log<level::ERR>("Error in mapper call to get service name",
+ entry("PATH=%s", path.c_str()),
+ entry("INTERFACE=%s", interface.c_str()));
+ elog<InternalFailure>();
}
@@ -65,8 +71,11 @@
if (mapperResponse.empty())
{
- throw std::runtime_error(
- "Error in mapper response for getting service name");
+ log<level::ERR>(
+ "Error in mapper response for getting service name",
+ entry("PATH=%s", path.c_str()),
+ entry("INTERFACE=%s", interface.c_str()));
+ elog<InternalFailure>();
}
return mapperResponse.begin()->first;