Added ErrHalt

This commit is contained in:
Leon Mika 2024-04-30 21:55:18 +10:00
parent d5ddecce33
commit 57781b5e3b
2 changed files with 5 additions and 0 deletions

View file

@ -73,6 +73,9 @@ func (inst *Inst) Out() io.Writer {
func (inst *Inst) Eval(ctx context.Context, expr string) (any, error) {
res, err := inst.eval(ctx, expr)
if err != nil {
if errors.Is(err, ErrHalt) {
return nil, nil
}
return nil, err
}

View file

@ -465,3 +465,5 @@ type errReturn struct {
func (e errReturn) Error() string {
return "return"
}
var ErrHalt = errors.New("halt")