diff --git a/eval/builtin_func.go b/eval/builtin_func.go index 51a0579d..83582f26 100644 --- a/eval/builtin_func.go +++ b/eval/builtin_func.go @@ -40,6 +40,7 @@ func init() { &BuiltinFn{"typeof", typeof}, &BuiltinFn{"fail", wrapFn(fail)}, + &BuiltinFn{"multi-error", wrapFn(multiErrorFn)}, &BuiltinFn{"return", wrapFn(returnFn)}, &BuiltinFn{"break", wrapFn(breakFn)}, &BuiltinFn{"continue", wrapFn(continueFn)}, @@ -191,6 +192,10 @@ func fail(ec *evalCtx, arg Value) { throw(errors.New(ToString(arg))) } +func multiErrorFn(ec *evalCtx, args ...Error) { + throw(multiError{args}) +} + func returnFn(ec *evalCtx) { throw(Return) } diff --git a/eval/value.go b/eval/value.go index e55000ce..8d536e4f 100644 --- a/eval/value.go +++ b/eval/value.go @@ -179,7 +179,7 @@ type multiError struct { func (me multiError) Repr() string { b := new(bytes.Buffer) - b.WriteString("(multi-error") + b.WriteString("?(multi-error") for _, e := range me.errors { b.WriteString(" ") b.WriteString(e.Repr())