Open rpbaltazar opened 9 years ago
Kindly provide more details about how you reached this issue. Would be great if you could share the piece of the code so that we can reproduce this error.
def forecast(location)
location_forecast = OpenWeather::Forecast.city(location)
if location_forecast['cod'] == '200'
forecast_to_use = get_closest_forecast location_forecast['list']
build_weather_string location, forecast_to_use
else
build_error_message location
end
end
Nothing special. I believe it might have to do with quotas and the openweather server answering with an error code and not parseable JSON. If you take a closer look at the error that I pasted before,
JSON::ParserError: 757: unexpected token at '500
Seams that the server is answering you with 500 (internal server error) and then you try to parse it which causes an exception.
JSON::ParserError: 757: unexpected token at '500 /proxy/data/2.5/forecast?q=%2ccoimbra%2c+pt& ' /app/vendor/bundle/ruby/2.0.0/gems/json-1.8.2/lib/json/common.rb:155:in
parse' /app/vendor/bundle/ruby/2.0.0/gems/json-1.8.2/lib/json/common.rb:155:in
parse' /app/vendor/bundle/ruby/2.0.0/gems/open-weather-0.11.0/lib/open_weather/base.rb:40:inparse_response' /app/vendor/bundle/ruby/2.0.0/gems/open-weather-0.11.0/lib/open_weather/base.rb:17:in
retrive' /app/vendor/bundle/ruby/2.0.0/gems/open-weather-0.11.0/lib/open_weather/api.rb:7:in `city'