Description
When using the logical and operator inline, JSONata reports an incorrect error message pointing to and, instead of the actual failing function call.
However, when the same expression is wrapped inside a user-defined function, the error is reported correctly.
This makes debugging more difficult, as the reported error source differs depending on context.
Reproduction
Case 1 – Inline expression (incorrect error)
(
1=1 and $contains([''], '')
)
Actual error
Argument 1 of function "and" does not match function signature
Case 2 – Expression inside a function (correct error)
(
$fn = function($a, $b) { $a and $b };
$fn(1=1, $contains([''], ''))
)
Actual error
Argument 1 of function "contains" does not match function signature
This is the correct and expected behavior.
Expected Behavior
Error reporting should be consistent regardless of whether the and operator is used inline or inside a user-defined function.
Specifically, errors should surface from the actual failing function call, not from the logical operator that combines expressions.
Description
When using the logical
andoperator inline, JSONata reports an incorrect error message pointing to and, instead of the actual failing function call.However, when the same expression is wrapped inside a user-defined function, the error is reported correctly.
This makes debugging more difficult, as the reported error source differs depending on context.
Reproduction
Case 1 – Inline expression (incorrect error)
Actual error
Case 2 – Expression inside a function (correct error)
Actual error
This is the correct and expected behavior.
Expected Behavior
Error reporting should be consistent regardless of whether the
andoperator is used inline or inside a user-defined function.Specifically, errors should surface from the actual failing function call, not from the logical operator that combines expressions.