mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
ircd:Ⓜ️ Handle and report hookfn exception.
This commit is contained in:
parent
bd29dec087
commit
c83a47eb0f
2 changed files with 25 additions and 1 deletions
|
@ -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 &);
|
||||
|
||||
|
|
24
ircd/m/m.cc
24
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
|
||||
|
|
Loading…
Reference in a new issue