lib/geocoder/lookups/baidu.rb in geocoder-1.1.9 vs lib/geocoder/lookups/baidu.rb in geocoder-1.2.0
- old
+ new
@@ -18,25 +18,26 @@
private # ---------------------------------------------------------------
def results(query, reverse = false)
return [] unless doc = fetch_data(query)
- case doc['status']; when 0
+ case doc['status']
+ when 0
return [doc['result']] unless doc['result'].blank?
when 1, 3, 4
- raise_error(Geocoder::Error, messages) ||
+ raise_error(Geocoder::Error, "server error.") ||
warn("Baidu Geocoding API error: server error.")
when 2
- raise_error(Geocoder::InvalidRequest, messages) ||
+ raise_error(Geocoder::InvalidRequest, "invalid request.") ||
warn("Baidu Geocoding API error: invalid request.")
when 5
- raise_error(Geocoder::InvalidApiKey, messages) ||
+ raise_error(Geocoder::InvalidApiKey, "invalid api key") ||
warn("Baidu Geocoding API error: invalid api key.")
when 101, 102, 200..299
- raise_error(Geocoder::RequestDenied) ||
+ raise_error(Geocoder::RequestDenied, "request denied") ||
warn("Baidu Geocoding API error: request denied.")
when 300..399
- raise_error(Geocoder::OverQueryLimitError) ||
+ raise_error(Geocoder::OverQueryLimitError, "over query limit.") ||
warn("Baidu Geocoding API error: over query limit.")
end
return []
end