Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify explicit error type for all error scenarios #115

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/specification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ Slice expressions adhere to the following rules:
* If no stop position is given, it is assumed to be the length of the array if
the given step is greater than 0 or 0 if the given step is less than 0.
* If the given step is omitted, it it assumed to be 1.
* If the given step is 0, an error MUST be raised.
* If the given step is 0, an ``invalid-value`` error MUST be raised.
Copy link
Member

@jamesls jamesls Mar 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EDIT: never mind, while the spec never specified the error type, the compliance tests did so I'm ok with updating the spec here.

* If the element being sliced is not an array, the result is ``null``.
* If the element being sliced is an array and yields no results, the result
MUST be an empty array.
Expand Down Expand Up @@ -987,8 +987,8 @@ As a shorthand, the type ``any`` is used to indicate that the argument can be
of any type (``array|object|number|string|boolean|null``).

JMESPath functions are required to type check their input arguments.
Specifying an invalid type for a function argument will result in a JMESPath
error.
Specifying an invalid type for a function argument will result in a
``invalid-type`` error.

The expression type, denoted by ``&expression``, is used to specify a
expression that is not immediately evaluated. Instead, a reference to that
Expand Down Expand Up @@ -1718,8 +1718,8 @@ in the array of ``elements``, the ``expr`` expression is applied and the
resulting value is used as the key used when sorting the ``elements``.

If the result of evaluating the ``expr`` against the current array element
results in type other than a ``number`` or a ``string``, a type error will
occur.
results in type other than a ``number`` or a ``string``, an ``invalid-type``
error will occur.

Below are several examples using the ``people`` array (defined above) as the
given input. ``sort_by`` follows the same sorting logic as the ``sort``
Expand Down