xgo/stdlib/errors.go

13 lines
205 B
Go
Raw Normal View History

2019-01-18 12:43:46 +03:00
package stdlib
2019-12-20 22:40:38 +03:00
import (
2019-12-30 00:38:51 +03:00
"github.com/d5/tengo/v2"
2019-12-20 22:40:38 +03:00
)
2019-12-20 22:40:38 +03:00
func wrapError(err error) tengo.Object {
if err == nil {
2019-12-20 22:40:38 +03:00
return tengo.TrueValue
}
2019-12-20 22:40:38 +03:00
return &tengo.Error{Value: &tengo.String{Value: err.Error()}}
}