diff options
Diffstat (limited to 'utils.hpp')
-rw-r--r-- | utils.hpp | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -1,7 +1,10 @@ #pragma once +#include "elog-errors.hpp" #include "types.hpp" +#include "xyz/openbmc_project/Time/Internal/error.hpp" +#include <phosphor-logging/elog.hpp> #include <phosphor-logging/log.hpp> #include <sdbusplus/bus.hpp> @@ -15,6 +18,8 @@ namespace utils { using namespace phosphor::logging; +using MethodErr = + sdbusplus::xyz::openbmc_project::Time::Internal::Error::MethodError; /** @brief Read data with type T from file * @@ -79,12 +84,11 @@ T getProperty(sdbusplus::bus::bus& bus, } else { - // TODO: use elog to throw exception - log<level::ERR>("Failed to get property", - entry("SERVICE=%s", service), - entry("PATH=%s", path), - entry("INTERFACE=%s", interface), - entry("PROPERTY=%s", propertyName)); + using namespace xyz::openbmc_project::Time::Internal; + elog<MethodErr>(MethodError::METHOD_NAME("Get"), + MethodError::PATH(path), + MethodError::INTERFACE(interface), + MethodError::MISC(propertyName)); } return value.template get<T>(); } |