Skip to content
Snippets Groups Projects
Commit 0a469463 authored by Anders Eriksson's avatar Anders Eriksson
Browse files

add error handling for Tencent status code 199

parent dd263a9b
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,9 @@ module Geocoder::Lookup
case doc['status']
when 0
return [doc[content_key]]
when 199
raise error(Geocoder::InvalidApiKey, "invalid api key") ||
Geocoder.log(:warn, "#{name} Geocoding API error: key is not enabled for web service usage.")
when 311
raise_error(Geocoder::RequestDenied, "request denied") ||
Geocoder.log(:warn, "#{name} Geocoding API error: request denied.")
......
......@@ -13,10 +13,9 @@ module Geocoder::Result
#@data['title'] or @data['address']
end
# The Tencent reverse reverse geocoding API has the field named
# NOTE: The Tencent reverse geocoding API has the field named
# 'address_component' compared to 'address_components' in the
# regular geocoding API.
def province
@data['address_components'] and (@data['address_components']['province']) or
(@data['address_component'] and @data['address_component']['province']) or
......
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