Allow rethrowing `MRB_TT_BREAK`
@@ -241,10 +241,15 @@ mrb_exc_set(mrb_state *mrb, mrb_value exc)
MRB_API mrb_noreturn void
mrb_exc_raise(mrb_state *mrb, mrb_value exc)
{
+ if (mrb_break_p(exc)) {
+ mrb->exc = mrb_obj_ptr(exc);
+ }
+ else {
if (!mrb_obj_is_kind_of(mrb, exc, mrb->eException_class)) {
mrb_raise(mrb, E_TYPE_ERROR, "exception object expected");
}
mrb_exc_set(mrb, exc);
+ }
if (!mrb->jmp) {
mrb_p(mrb, exc);
abort();
