You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/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
Steps to reproduce
Set up a Ruby on Rails application with Geocoder and configure it for MapBox, but with an invalid auth token. Try to save an Address model that uses Geocoder.
irb(main):001:0> a = Address.find 47
Address Load (0.6ms) SELECT "addresses".* FROM "addresses" WHERE "addresses"."id" = $1 LIMIT $2 [["id", 47], ["LIMIT", 1]]
=>
#<Address:0x0000741c81b8f2b0
...
> a.save
TRANSACTION (0.2ms) BEGIN
Dalli::Server#connect 170.23.0.7:11211
Geocoding API error: 401 Unauthorized
TRANSACTION (0.3ms) ROLLBACK
/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
Thanks for this. I agree that it should be handled more gracefully. A Geocoder::InvalidApiKey exception should be raised (if exception-raising is configured) or an empty array should be returned. Looks like the test that checks this isn't written properly. I'm open to a pull request.
Expected behavior
No error should be thrown.
Actual behavior
The following error is produced:
Steps to reproduce
Set up a Ruby on Rails application with Geocoder and configure it for MapBox, but with an invalid auth token. Try to save an Address model that uses Geocoder.
Environment info
More information
Geocoder configuration.
The text was updated successfully, but these errors were encountered: