diff options
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>(); } } |