Added ErrHalt
This commit is contained in:
parent
d5ddecce33
commit
57781b5e3b
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -465,3 +465,5 @@ type errReturn struct {
|
|||
func (e errReturn) Error() string {
|
||||
return "return"
|
||||
}
|
||||
|
||||
var ErrHalt = errors.New("halt")
|
||||
|
|
Loading…
Reference in a new issue