camunda/feel-scala

Make failure messages more readable

Closed this issue · 0 comments

Description

Since version 1.17.0, we report failure messages if the evaluation results in null unintentionally. These failure messages are available for the caller of the API as part of the evaluation result.

Currently, these failure messages contain some technical details, like type information of the value. We should improve the readability of these messages.

For example

// Before
Can't compare ValNumber(1) with ValBoolean(true)

// After
Can't compare '1' with 'true'

it should "return null if the values have a different type" in {
    evaluateExpression("1 = true") should (returnNull() and reportFailure(
      failureType = EvaluationFailureType.NOT_COMPARABLE,
      failureMessage = "Can't compare ValNumber(1) with ValBoolean(true)"

💭 Val objects are only for internal usage. Maybe we can find a way to build the error message with the correct type, like boolean, string, number .....

Originally posted by @nicpuppa in #711 (comment)