Skip to content
Snippets Groups Projects
Commit b5d89488 authored by Luke Wendling's avatar Luke Wendling
Browse files

add yahoo auth errors raw message to warnings

parent fad62741
No related branches found
No related tags found
No related merge requests found
......@@ -46,13 +46,15 @@ module Geocoder::Lookup
# Yahoo returns errors as XML even when JSON format is specified.
# Handle that here, without parsing the XML
# (which would add unnecessary complexity).
# Yahoo auth errors can also be cryptic, so add raw error desc
# to warning message.
#
def parse_raw_data(raw_data)
if raw_data.match /^<\?xml/
if raw_data.include?("Rate Limit Exceeded")
raise_error(Geocoder::OverQueryLimitError) || warn("Over API query limit.")
elsif raw_data.include?("Please provide valid credentials")
raise_error(Geocoder::InvalidApiKey) || warn("Invalid API key.")
elsif raw_data =~ /\n(.*Please provide valid credentials.*)\n/
raise_error(Geocoder::InvalidApiKey) || warn("Invalid API key. Error response: #{$1}")
end
else
super(raw_data)
......
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