Skip to content
Snippets Groups Projects
Commit 16fd4bad authored by Alex Reisner's avatar Alex Reisner
Browse files

Warn about error, if one occurs.

The version_x_results methods will return nil in case of an error. We
need to detect that and not execute that branch of the 'if' statement.
parent 04e6eef1
No related branches found
No related tags found
No related merge requests found
......@@ -13,10 +13,10 @@ module Geocoder::Lookup
def results(query)
return [] unless doc = fetch_data(query)
doc = doc['ResultSet']
if api_version(doc).to_i == 1
return version_1_results(doc)
elsif api_version(doc).to_i == 2
return version_2_results(doc)
if api_version(doc).to_i == 1 and r = version_1_results(doc)
return r
elsif api_version(doc).to_i == 2 and r = version_2_results(doc)
return r
else
warn "Yahoo Geocoding API error: #{doc['Error']} (#{doc['ErrorMessage']})."
return []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment