diff --git a/lib/geocoder/exceptions.rb b/lib/geocoder/exceptions.rb index 208ca979e4bd91b338b774f3827be67cff3bfb9f..0ed0eb0d3954d0d2b6457655aff9f66a0c1b3250 100644 --- a/lib/geocoder/exceptions.rb +++ b/lib/geocoder/exceptions.rb @@ -8,4 +8,11 @@ module Geocoder class OverQueryLimitError < Error end + + class RequestDenied < Error + end + + class InvalidRequest < Error + end + end diff --git a/lib/geocoder/lookups/google.rb b/lib/geocoder/lookups/google.rb index 21ae3cfafb35412176bc4b4951bd58169bcfd0f6..6898c267551bc056834cf7969fda1bb7fa46f4a3 100644 --- a/lib/geocoder/lookups/google.rb +++ b/lib/geocoder/lookups/google.rb @@ -18,9 +18,11 @@ module Geocoder::Lookup raise_error(Geocoder::OverQueryLimitError) || warn("Google Geocoding API error: over query limit.") when "REQUEST_DENIED" - warn "Google Geocoding API error: request denied." + raise_error(Geocoder::RequestDenied) || + warn("Google Geocoding API error: request denied.") when "INVALID_REQUEST" - warn "Google Geocoding API error: invalid request." + raise_error(Geocoder::InvalidRequest) || + warn("Google Geocoding API error: invalid request.") end return [] end