xref: /openbmc/bmcweb/features/redfish/include/utils/dbus_utils.hpp (revision 62598e31d0988d589506d5091bd38f72d61faf5e)
1351053f2SKrzysztof Grobelny #pragma once
2351053f2SKrzysztof Grobelny 
3351053f2SKrzysztof Grobelny #include "logging.hpp"
4351053f2SKrzysztof Grobelny 
5351053f2SKrzysztof Grobelny #include <sdbusplus/unpack_properties.hpp>
6351053f2SKrzysztof Grobelny 
7351053f2SKrzysztof Grobelny namespace redfish
8351053f2SKrzysztof Grobelny {
9351053f2SKrzysztof Grobelny namespace dbus_utils
10351053f2SKrzysztof Grobelny {
11351053f2SKrzysztof Grobelny 
12351053f2SKrzysztof Grobelny struct UnpackErrorPrinter
13351053f2SKrzysztof Grobelny {
14351053f2SKrzysztof Grobelny     void operator()(const sdbusplus::UnpackErrorReason reason,
15351053f2SKrzysztof Grobelny                     const std::string& property) const noexcept
16351053f2SKrzysztof Grobelny     {
17*62598e31SEd Tanous         BMCWEB_LOG_ERROR(
18*62598e31SEd Tanous             "DBUS property error in property: {}, reason: {}", property,
19*62598e31SEd Tanous             static_cast<std::underlying_type_t<sdbusplus::UnpackErrorReason>>(
20*62598e31SEd Tanous                 reason));
21351053f2SKrzysztof Grobelny     }
22351053f2SKrzysztof Grobelny };
23351053f2SKrzysztof Grobelny 
24351053f2SKrzysztof Grobelny } // namespace dbus_utils
25351053f2SKrzysztof Grobelny } // namespace redfish
26