Skip to content

Misleading error message for error in function body #297

@bimmlerd

Description

@bimmlerd

Hello,

We are seeing undescriptive/misleading error messages when an error occurs within a function. Two minimal examples follow.

(
$A := function(){$min(2, 3)};
$A()
)

Link to JSONata exerciser

This throws Argument 2 of function "A" does not match function signature, which is hard to understand, since A does not seem to take arguments. Furthermore, the offending call is to min, not A.

Similarly,

(
$B := function(){""};
$A := function(){2 + $B()};
$A()
)

Link to JSONata exerciser

throws The right side of the "A" operator must evaluate to a number. This is unexpected as it should say the right side of the + operator must evaluate to a number.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions