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) {
|
func (inst *Inst) Eval(ctx context.Context, expr string) (any, error) {
|
||||||
res, err := inst.eval(ctx, expr)
|
res, err := inst.eval(ctx, expr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if errors.Is(err, ErrHalt) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -465,3 +465,5 @@ type errReturn struct {
|
||||||
func (e errReturn) Error() string {
|
func (e errReturn) Error() string {
|
||||||
return "return"
|
return "return"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ErrHalt = errors.New("halt")
|
||||||
|
|
Loading…
Reference in a new issue