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

bug: Fixed unexpected error with invalid api key when exception-raising is not configured #1682

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

ys7i
Copy link
Contributor

@ys7i ys7i commented Mar 11, 2025

This PR fix the open bug issue #1657 .

Bug

If geocoder is configured with MapBox and invalid api key and always_raise doesn't contain Geocoder::InvalidApiKey, Geocoder.search will throw the following error.

/usr/local/bundle/gems/geocoder-1.8.3/lib/geocoder/lookups/base.rb:46:in `search': undefined method `map' for false:FalseClass (NoMethodError)

        results(query).map{ |r|
                      ^^^^
Did you mean?  tap

Why this happened

results(query) is evaluated as false in

results(query).map{ |r|

because raise_error is called in the results method, and results returns false if always_raise doesn't contain the argument error.

@alexreisner
Copy link
Owner

This is excellent, thanks!

@alexreisner alexreisner merged commit 80a529d into alexreisner:master Mar 12, 2025
5 checks passed
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