Skip to content

Commit

Permalink
Handle any failure to match a token
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbuddy committed May 9, 2023
1 parent 2c7cea8 commit 804a5af
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/jsonpath.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ def initialize(path, opts = {})
nil
elsif (token = scanner.scan(/[><=] \d+/))
@path.last << token
elsif (token = scanner.scan(/./m))
begin
@path.last << token
rescue RuntimeError
raise ArgumentError, "character '#{token}' not supported in query"
end
elsif (token = scanner.scan(/./))
@path.last << token
else
raise ArgumentError, "character '#{scanner.peek(1)}' not supported in query"
end
end
end
Expand Down

0 comments on commit 804a5af

Please sign in to comment.