summaryrefslogtreecommitdiffstats
path: root/utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils.hpp')
-rw-r--r--utils.hpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/utils.hpp b/utils.hpp
index ea2e3e4..87bc2bf 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -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>();
}
OpenPOWER on IntegriCloud