Class: Evrythng::Response::RaiseServerError
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Evrythng::Response::RaiseServerError
- Defined in:
- lib/evrythng/response/raise_server_error.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/evrythng/response/raise_server_error.rb', line 10 def on_complete(env) case env[:status].to_i when 500 raise Evrythng::Error::InternalServerError.new("Something is technically wrong.", env[:response_headers]) when 502 raise Evrythng::Error::BadGateway.new("Evrythng is down or being upgraded.", env[:response_headers]) when 503 raise Evrythng::Error::ServiceUnavailable.new("Evrythng is over capacity.", env[:response_headers]) end end |