0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-01 19:22:53 +01:00

ircd:Ⓜ️:vm: Properly propagate a context interruption to the evaluator.

This commit is contained in:
Jason Volk 2018-04-12 23:06:02 -07:00
parent 56234556e8
commit 45f8239f9b
2 changed files with 14 additions and 0 deletions

View file

@ -72,6 +72,7 @@ enum ircd::m::vm::fault
GENERAL = 0x10, ///< General protection fault. (#gp) GENERAL = 0x10, ///< General protection fault. (#gp)
EVENT = 0x20, ///< Eval requires addl events in the ef register (#ef) EVENT = 0x20, ///< Eval requires addl events in the ef register (#ef)
STATE = 0x40, ///< Required state is missing (#st) STATE = 0x40, ///< Required state is missing (#st)
INTERRUPT = 0x80, ///< ctx::interrupted (#nmi)
}; };
/// Evaluation Options /// Evaluation Options

View file

@ -308,6 +308,19 @@ catch(const error &e)
throw; throw;
} }
catch(const ctx::interrupted &e)
{
if(opts->errorlog & fault::INTERRUPT)
log.error("eval %s: #NMI: %s",
json::get<"event_id"_>(event)?: json::string{"<edu>"},
e.what());
if(opts->warnlog & fault::INTERRUPT)
log.warning("eval %s: #NMI: %s",
json::get<"event_id"_>(event)?: json::string{"<edu>"},
e.what());
throw;
}
catch(const std::exception &e) catch(const std::exception &e)
{ {
if(opts->errorlog & fault::GENERAL) if(opts->errorlog & fault::GENERAL)