Closed brandonchinn178 closed 5 months ago
It'd be nice to be able to throw an error and get a stack trace in Starlark. Even if #230 isn't feasible, could a hardcoded fail function be implemented? Something like:
fail
state.Globals["fail"] = starlark.NewBuiltin( "fail", func(thread *Thread, fn *Builtin, args Tuple, kwargs []Tuple) (starlark.Value, error) { var msg string err = UnpackPositionalArgs("fail", args, kwargs, 1, &msg) if err != nil { return nil, err } return nil, fmt.Errorf(msg) }, )
I'm dumb, fail() does work today
fail()
It'd be nice to be able to throw an error and get a stack trace in Starlark. Even if #230 isn't feasible, could a hardcoded
fail
function be implemented? Something like: