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 /utility.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 'utility.cpp')
-rw-r--r-- | utility.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
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<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 @@ std::string getService(const std::string& path, 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; |