jmespath / jmespath.site

The repo for the jmespath.org website.
http://jmespath.org/
Apache License 2.0
56 stars 51 forks source link

Specify explicit error type for all error scenarios #115

Closed sebastien-rosset closed 1 year ago

sebastien-rosset commented 1 year ago

This PR changes the wording of the spec to state the specific error type in all error scenarios.

I have found 34 occurrences of the word "error" in the spec. In most cases, the spec indicates the exact type of error, e.g., invalid-type, unknown-function, invalid-arity. However, there are three occurrences when no explicit error type is mentioned.

In two cases, I think the right error type is invalid-type. In the third case (Slices section), I'm not sure what the error type should be. Maybe invalid-value, but it's not specified anywhere in the spec (I see only three error types defined). Related to this, I have raised #116 to add a section for error handling.

- If the given step is 0, an error MUST be raised.
+ If the given step is 0, an `invalid-value` error MUST be raised.
springcomp commented 1 year ago

invalid-value is indeed a new error type introduced in JMESPath Community that did not originally exists, but I think it’s a good error to report in this case.

jamesls commented 1 year ago

Rebased and merged in 98abdcf, thanks again!