blob: eea894759a4c35986932ba7e67ce8cd585499aa6 [file] [log] [blame]
#pragma once
#include <nlohmann/json.hpp>
#include <sdbusplus/exception.hpp>
#include <source_location>
namespace sdbusplus::sdbuspp
{
using register_hook =
std::function<void(const nlohmann::json&, const std::source_location&)>;
void register_event(const std::string&, register_hook);
template <typename T>
struct register_event_helper
{
static void hook()
{
register_event(T::errName, throw_event);
}
static void throw_event(const nlohmann::json& j,
const std::source_location& location)
{
throw T(j, location);
}
};
} // namespace sdbusplus::sdbuspp