0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-10-01 21:28:53 +02:00

ircd:Ⓜ️ Handle and report hookfn exception.

This commit is contained in:
Jason Volk 2018-03-16 13:13:33 -07:00
parent bd29dec087
commit c83a47eb0f
2 changed files with 25 additions and 1 deletions

View file

@ -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 &);

View file

@ -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