3500c686b3
- add type infos to VM error messages - add 'Name' to UserFunction objects - add 'expectErrorString' to VM tests - replace vm.expectError() with vm.expectErrorString() to make it more explicit - add source map info to VM error messages - optimization in function calls - add file/line/col info to compiler errors - change stdlib module to be loaded from VM (instead of compiler) so they can be properly loaded after the source is compiled into binary - VM can take builtin modules optionally
11 lines
214 B
Go
11 lines
214 B
Go
package stdlib
|
|
|
|
import "github.com/d5/tengo/objects"
|
|
|
|
func wrapError(err error) objects.Object {
|
|
if err == nil {
|
|
return objects.TrueValue
|
|
}
|
|
|
|
return &objects.Error{Value: &objects.String{Value: err.Error()}}
|
|
}
|