mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
Improve exception handling around several hook handlers.
Revert "modules/vm: Allow ctx::interrupted to propagate call_hook()."
This also reverts commit cdae254e14
.
This commit is contained in:
parent
e4e15e6391
commit
6a7e7f448b
3 changed files with 28 additions and 13 deletions
|
@ -35,6 +35,7 @@ _join_room__m_direct_hookfn
|
|||
void
|
||||
_join_room__m_direct(const m::event &event,
|
||||
m::vm::eval &eval)
|
||||
try
|
||||
{
|
||||
const m::user::id &user_id
|
||||
{
|
||||
|
@ -125,3 +126,13 @@ _join_room__m_direct(const m::event &event,
|
|||
top.~object();
|
||||
account_data.set("m.direct", json::object(out.completed()));
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
log::error
|
||||
{
|
||||
m::log, "Failure while setting m.direct account_data for %s in %s :%s",
|
||||
json::get<"sender"_>(event),
|
||||
json::get<"room_id"_>(event),
|
||||
e.what()
|
||||
};
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ ircd::m::affect_user_room_hookfn
|
|||
void
|
||||
ircd::m::affect_user_room(const m::event &event,
|
||||
m::vm::eval &eval)
|
||||
try
|
||||
{
|
||||
const auto &room_id
|
||||
{
|
||||
|
@ -69,9 +70,24 @@ ircd::m::affect_user_room(const m::event &event,
|
|||
create(subject);
|
||||
|
||||
//TODO: ABA / TXN
|
||||
m::user::room user_room{subject};
|
||||
m::user::room user_room
|
||||
{
|
||||
subject
|
||||
};
|
||||
|
||||
send(user_room, sender, "ircd.member", room_id, at<"content"_>(event));
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
log::error
|
||||
{
|
||||
log, "Failed to update user %s room for membership change in %s by %s :%s",
|
||||
json::get<"state_key"_>(event),
|
||||
json::get<"room_id"_>(event),
|
||||
json::get<"sender"_>(event),
|
||||
e.what()
|
||||
};
|
||||
}
|
||||
|
||||
decltype(ircd::m::auth_room_member_hookfn)
|
||||
ircd::m::auth_room_member_hookfn
|
||||
|
|
|
@ -1088,18 +1088,6 @@ try
|
|||
{
|
||||
hook(event, std::forward<T>(data));
|
||||
}
|
||||
catch(const ctx::interrupted &e)
|
||||
{
|
||||
log::derror
|
||||
{
|
||||
"%s | phase:%s :%s",
|
||||
loghead(eval),
|
||||
unquote(hook.feature.get("name")),
|
||||
e.what(),
|
||||
};
|
||||
|
||||
throw;
|
||||
}
|
||||
catch(const m::error &e)
|
||||
{
|
||||
log::derror
|
||||
|
|
Loading…
Reference in a new issue