Skip to content

Commit

Permalink
Added hint when using certain tokens in when expressions (#1810)
Browse files Browse the repository at this point in the history
* Added hint when using certain tokens in when expressions

* Minor
  • Loading branch information
simster7 authored and sarabala1979 committed Dec 5, 2019
1 parent 15a0aa7 commit 400274f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions workflow/controller/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ func shouldExecute(when string) (bool, error) {
}
expression, err := govaluate.NewEvaluableExpression(when)
if err != nil {
if strings.Contains(err.Error(), "Invalid token") {
return false, errors.Errorf(errors.CodeBadRequest, "Invalid 'when' expression '%s': %v (hint: try wrapping the affected expression in quotes (\"))", when, err)
}
return false, errors.Errorf(errors.CodeBadRequest, "Invalid 'when' expression '%s': %v", when, err)
}
// The following loop converts govaluate variables (which we don't use), into strings. This
Expand Down

0 comments on commit 400274f

Please sign in to comment.