0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-30 12:48:54 +02:00

modules/vm: Reorg the main eval exception handlers.

This commit is contained in:
Jason Volk 2018-05-14 22:24:03 -07:00
parent 8fefae157a
commit 887cd2398d

View file

@ -458,7 +458,27 @@ try
return ret; return ret;
} }
catch(const error &e) catch(const ctx::interrupted &e) // INTERRUPTION
{
if(eval.opts->errorlog & fault::INTERRUPT)
log::error
{
log, "eval %s: #NMI: %s",
json::get<"event_id"_>(event)?: json::string{"<edu>"},
e.what()
};
if(eval.opts->warnlog & fault::INTERRUPT)
log::warning
{
log, "eval %s: #NMI: %s",
json::get<"event_id"_>(event)?: json::string{"<edu>"},
e.what()
};
throw;
}
catch(const error &e) // VM FAULT CODE
{ {
if(eval.opts->errorlog & e.code) if(eval.opts->errorlog & e.code)
log::error log::error
@ -483,27 +503,32 @@ catch(const error &e)
throw; throw;
} }
catch(const ctx::interrupted &e) catch(const m::error &e) // GENERAL MATRIX ERROR
{ {
if(eval.opts->errorlog & fault::INTERRUPT) if(eval.opts->errorlog & fault::GENERAL)
log::error log::error
{ {
log, "eval %s: #NMI: %s", log, "eval %s: #GP: %s :%s",
json::get<"event_id"_>(event)?: json::string{"<edu>"}, json::get<"event_id"_>(event)?: json::string{"<edu>"},
e.what() e.what(),
e.content
}; };
if(eval.opts->warnlog & fault::INTERRUPT) if(eval.opts->warnlog & fault::GENERAL)
log::warning log::warning
{ {
log, "eval %s: #NMI: %s", log, "eval %s: #GP: %s :%s",
json::get<"event_id"_>(event)?: json::string{"<edu>"}, json::get<"event_id"_>(event)?: json::string{"<edu>"},
e.what() e.what(),
e.content
}; };
if(eval.opts->nothrows & fault::GENERAL)
return fault::GENERAL;
throw; throw;
} }
catch(const std::exception &e) catch(const std::exception &e) // ALL OTHER ERRORS
{ {
if(eval.opts->errorlog & fault::GENERAL) if(eval.opts->errorlog & fault::GENERAL)
log::error log::error