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.hpp | |
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.hpp')
-rw-r--r-- | utility.hpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/utility.hpp b/utility.hpp index 880545a..32d055e 100644 --- a/utility.hpp +++ b/utility.hpp @@ -3,8 +3,16 @@ #include <sdbusplus/bus.hpp> #include <unistd.h> #include <fcntl.h> +#include <phosphor-logging/log.hpp> +#include <phosphor-logging/elog.hpp> +#include <phosphor-logging/elog-errors.hpp> +#include <xyz/openbmc_project/Common/error.hpp> +using namespace phosphor::logging; +using InternalFailure = sdbusplus::xyz::openbmc_project::Common:: + Error::InternalFailure; + namespace phosphor { namespace fan @@ -43,8 +51,10 @@ class FileDescriptor fd = ::open(pathname.c_str(), flags); if (-1 == fd) { - throw std::runtime_error( - "Failed to open file device: " + pathname); + log<level::ERR>( + "Failed to open file device: ", + entry("PATHNAME=%s", pathname.c_str())); + elog<InternalFailure>(); } } |