-
Notifications
You must be signed in to change notification settings - Fork 174
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
Raise exception when match failure, to distinguish from “matched, value is None” #113
Comments
If you want to check if a key exists in the hash, you can use the
Let me know if that doesn't work for you. |
The JMESPath specification says, about the value returned for a search:
So if the value associated with the identifier is I maintain the specification is broken by design. The “does not exist” behaviour should, in order to be easily detected, be entirely disjoint from any valid value that could be returned by a match. Raising an exception would be an appropriate implementation. So that's a bug in the specification. I don't know where to report that. |
The jmespath.search function returns None in two distinct cases:
It appears the JMESPath search API returns None in these two distinct cases. How can the caller know the difference between them?
I would expect no return in the case of a match failure, and instead an exception (such as KeyError or ValueError).
The text was updated successfully, but these errors were encountered: