Skip to content

Improved error handling - #29

Merged
trevorrowe merged 1 commit into
jmespath:masterfrom
stenlarsson:master
Jul 7, 2016
Merged

trevorrowe merged 1 commit into
jmespath:masterfrom
stenlarsson:master

Conversation

@stenlarsson

@stenlarsson stenlarsson commented Apr 28, 2016 •

Copy link
Copy Markdown
Contributor

Consider the following expression:

`foo`

This expression contains an invalid json-value, and this will raise the unhelpful error unexpected token 0. The reason for the zero is that Symbol#match surprisingly returns a fixnum, unlike String#match. Still, unexpected token unknown would not be much better, therefore unknown tokens raise a separate error, in this case unknown token "foo".

(Note that this particular expression is accepted by other implementations, but I don't think it should be according to the specification.)

1. `Symbol#match` and `String#match` surprisingly doesn't have the same return type
2. Raise a better error on an unknown token
@trevorrowe
trevorrowe merged commit e164f0b into jmespath:master Jul 7, 2016
@trevorrowe

Copy link
Copy Markdown
Contributor

Sorry for the slow response. Thank you for the fix. This should be part of the 1.3 release shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants