diff --git a/include/ircd/m/hook.h b/include/ircd/m/hook.h index 71abca565..d4094347c 100644 --- a/include/ircd/m/hook.h +++ b/include/ircd/m/hook.h @@ -65,6 +65,8 @@ struct ircd::m::hook::site bool add(hook &); bool del(hook &); + void call(hook &, const event &); + public: void operator()(const event &); diff --git a/ircd/m/m.cc b/ircd/m/m.cc index 63dd36581..e02e954b6 100644 --- a/ircd/m/m.cc +++ b/ircd/m/m.cc @@ -1521,7 +1521,29 @@ ircd::m::hook::site::operator()(const event &event) } for(const auto &hook : matching) - hook->function(event); + call(*hook, event); +} + +void +ircd::m::hook::site::call(hook &hook, + const event &event) +try +{ + hook.function(event); +} +catch(const ctx::interrupted &e) +{ + throw; +} +catch(const std::exception &e) +{ + log::critical + { + "Unhandled hookfn(%p) %s error :%s", + &hook, + string_view{hook.feature}, + e.what() + }; } bool