Class: OpenWeather::Response::RaiseError
- Inherits:
-
Faraday::Response::RaiseError
- Object
- Faraday::Response::RaiseError
- OpenWeather::Response::RaiseError
- Defined in:
- lib/open_weather/raise_error.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/open_weather/raise_error.rb', line 6 def on_complete(env) case env[:status] when 404 raise Faraday::ResourceNotFound, response_values(env) when 407 # mimic the behavior that we get with proxy requests with HTTPS raise Faraday::ConnectionFailed, %(407 "Proxy Authentication Required ") when (400...600).freeze raise OpenWeather::Errors::Fault, response_values(env) end end |
#response_values(env) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/open_weather/raise_error.rb', line 18 def response_values(env) { status: env.status, headers: env.response_headers, body: env.body } end |