From ce7760b21326708d45909f450003d9c9225921ba Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 3 Mar 2023 15:45:21 -0800 Subject: [PATCH] ircd::m::vm::execute: Fix propagation of conformity exceptions masked by opts. --- matrix/vm_execute.cc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/matrix/vm_execute.cc b/matrix/vm_execute.cc index da45c3381..8bc7c9999 100644 --- a/matrix/vm_execute.cc +++ b/matrix/vm_execute.cc @@ -346,7 +346,7 @@ try // Conformity checks only require the event data itself; note that some // local queries may still be made by the hook, such as m::redacted(). - if(likely(opts.phase[phase::CONFORM]) && !opts.edu) + if(likely(opts.phase[phase::CONFORM]) && !opts.edu) try { const scope_restore eval_phase { @@ -355,6 +355,22 @@ try call_hook(conform_hook, eval, event, eval); } + catch(const vm::error &e) + { + return handle_fault + ( + *eval.opts, e.code, event.event_id, + "eval %s %s :%s :%s", + event.event_id? + string_view{event.event_id}: + ""_sv, + json::get<"room_id"_>(event)? + string_view{json::get<"room_id"_>(event)}: + ""_sv, + e.what(), + e.content + ); + } // If the event is simply missing content while not being authoritatively // redacted, the conformity phase would have thrown a prior exception. Now