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

Issue warning on Google API quota error.

parent 0eb01736
No related branches found
No related tags found
No related merge requests found
......@@ -175,10 +175,7 @@ If anyone has a more elegant solution to this problem I am very interested in se
== To-do List
* handle OVER_QUERY_LIMIT error
* raise exception? maybe only when address! or search! is called
* print warning?
* support DataMapper, Mongoid, etc
* support different ORMs (DataMapper, Mongoid, etc)
* use completely separate "drivers" for different AR adapters?
* seems reasonable since we're using very DB-specific features
* also need to make sure 'mysql2' is supported
......
......@@ -49,7 +49,11 @@ module Geocoder
def parsed_response(query, reverse = false)
if doc = fetch_data(query, reverse)
doc = ActiveSupport::JSON.decode(doc)
doc && doc['status'] == "OK" ? doc : nil
if doc && doc['status'] == "OK"
return doc
elsif doc['status'] == "OVER_QUERY_LIMIT"
warn "Google Geocoder API error: quota exceeded."
end
end
end
......@@ -78,3 +82,4 @@ module Geocoder
end
end
end
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