0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 00:32:35 +01:00

modules/m_vm_fetch: Fixes for exception propagation and reporting.

This commit is contained in:
Jason Volk 2020-03-28 12:10:51 -07:00
parent 7e99a86512
commit b95f6e1af4

View file

@ -134,6 +134,10 @@ try
if(opts.fetch_state) if(opts.fetch_state)
state(event, eval, room); state(event, eval, room);
} }
catch(const ctx::interrupted &)
{
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::derror log::derror
@ -283,6 +287,10 @@ catch(const vm::error &e)
{ {
throw; throw;
} }
catch(const ctx::interrupted &)
{
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::error log::error
@ -324,6 +332,10 @@ try
auth_chain, opts auth_chain, opts
}; };
} }
catch(const ctx::interrupted &)
{
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
log::error log::error
@ -345,6 +357,7 @@ void
ircd::m::vm::fetch::state(const event &event, ircd::m::vm::fetch::state(const event &event,
vm::eval &eval, vm::eval &eval,
const room &room) const room &room)
try
{ {
const event::prev prev{event}; const event::prev prev{event};
const size_t prev_miss const size_t prev_miss
@ -442,6 +455,22 @@ ircd::m::vm::fetch::state(const event &event,
fail, fail,
}; };
} }
catch(const ctx::interrupted &)
{
throw;
}
catch(const std::exception &e)
{
log::error
{
log, "%s state fetch in %s :%s",
loghead(eval),
string_view{room.room_id},
e.what(),
};
throw;
}
std::forward_list std::forward_list
< <
@ -647,7 +676,7 @@ ircd::m::vm::fetch::prev_fetch(const event &event,
> >
ret; ret;
const event::prev prev{event}; const event::prev prev{event};
for(size_t i(0); i < prev.prev_events_count(); ++i) for(size_t i(0); i < prev.prev_events_count(); ++i) try
{ {
const auto &prev_id const auto &prev_id
{ {
@ -683,6 +712,21 @@ ircd::m::vm::fetch::prev_fetch(const event &event,
ret.emplace_front(m::fetch::start(opts)); ret.emplace_front(m::fetch::start(opts));
} }
catch(const ctx::interrupted &)
{
throw;
}
catch(const std::exception &e)
{
log::derror
{
log, "%s requesting backfill off prev %s; depth:%ld :%s",
loghead(eval),
string_view{prev.prev_event(i)},
json::get<"depth"_>(event),
e.what(),
};
}
return ret; return ret;
} }