Class: FaradayMiddleware::RaiseOnError
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- FaradayMiddleware::RaiseOnError
- Defined in:
- lib/faraday/raise_on_error.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/faraday/raise_on_error.rb', line 4 def on_complete(env) case env[:status] when 404 raise Cambio::NotFoundError, (env) when 401 raise Cambio::UnauthorisedError, (env) when 500 raise Cambio::ServerError, (env) when 400...600 raise Cambio::Error, (env) end end |