diff --git a/lib/geocoder/exceptions.rb b/lib/geocoder/exceptions.rb index 0294c8d8666aa88266835a1afd1971bcfed509e1..208ca979e4bd91b338b774f3827be67cff3bfb9f 100644 --- a/lib/geocoder/exceptions.rb +++ b/lib/geocoder/exceptions.rb @@ -5,4 +5,7 @@ module Geocoder class ConfigurationError < Error end + + class OverQueryLimitError < Error + end end diff --git a/lib/geocoder/lookups/google.rb b/lib/geocoder/lookups/google.rb index 9d0395503b2904654dcb69667742d43c61b944b7..21ae3cfafb35412176bc4b4951bd58169bcfd0f6 100644 --- a/lib/geocoder/lookups/google.rb +++ b/lib/geocoder/lookups/google.rb @@ -15,7 +15,8 @@ module Geocoder::Lookup case doc['status']; when "OK" # OK status implies >0 results return doc['results'] when "OVER_QUERY_LIMIT" - warn "Google Geocoding API error: over query limit." + raise_error(Geocoder::OverQueryLimitError) || + warn("Google Geocoding API error: over query limit.") when "REQUEST_DENIED" warn "Google Geocoding API error: request denied." when "INVALID_REQUEST"