Skip to content

Commit

Permalink
chore: catch panic
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Dec 31, 2023
1 parent 519bcd4 commit 4a57a30
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion provider/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ func (p *Go) handleSetter(param string, val any) error {
return transformOutputs(p.out, vv)
}

func (p *Go) evaluate() (any, error) {
func (p *Go) evaluate() (res any, err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("go script panic: %v", r)
}
}()

v, err := p.vm.Eval(p.script)
if err != nil {
return nil, err
Expand Down

0 comments on commit 4a57a30

Please sign in to comment.