Skip to content

Commit

Permalink
Fixed logic issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaynalawade authored Apr 26, 2021
1 parent 7e9c70c commit 98fe0ee
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions activity/jsexec/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,28 @@ func (a *Activity) Eval(ctx activity.Context) (done bool, err error) {
if err != nil {
output.Error = true
output.ErrorMessage = err.Error()
return true, nil
}
//todo is ok to ignore the errors for the SetInVM calls?
_ = vm.SetInVM("parameters", input.Parameters)
_ = vm.SetInVM("result", result)

_, err = vm.vm.RunScript("JSServiceScript", a.script)
if err != nil {
output.Error = true
output.ErrorMessage = err.Error()
return true, nil
}
err = vm.GetFromVM("result", &result)
if err != nil {
output.Error = true
output.ErrorMessage = err.Error()
return true, nil
}
output.Result = result
if vm != nil {
//todo is ok to ignore the errors for the SetInVM calls?
_ = vm.SetInVM("parameters", input.Parameters)
_ = vm.SetInVM("result", result)

_, err = vm.vm.RunScript("JSServiceScript", a.script)
if err != nil {
output.Error = true
output.ErrorMessage = err.Error()
} else {
err = vm.GetFromVM("result", &result)
if err != nil {
output.Error = true
output.ErrorMessage = err.Error()
} else {
output.Error = false
output.ErrorMessage = ""
output.Result = result
}
}
}

err = ctx.SetOutputObject(&output)
if err != nil {
Expand Down

0 comments on commit 98fe0ee

Please sign in to comment.