jmespath.js icon indicating copy to clipboard operation
jmespath.js copied to clipboard

Length throws an error when evaluating a null node

Open jeskew opened this issue 8 years ago • 0 comments

If the expression passed to a length function call resolves to null, an error will be thrown. Normally, evaluating any JMESPath expression will return a result or null, but if that expression calls any functions then it must be wrapped in a try/catch block to be safely evaluated.

This seems to be in compliance with the specification, which states that "Specifying an invalid type for a function argument will result in a JMESPath error." However, this requires callers to know about the content of a given JMESPath expression before evaluating it.

jeskew avatar May 02 '17 17:05 jeskew