Class: MnClient::Response::RaiseError
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- MnClient::Response::RaiseError
- Defined in:
- lib/mn_client/response/raise_error.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mn_client/response/raise_error.rb', line 8 def on_complete(env) case env[:status].to_i when 400 raise MnClient::BadRequest.new((env)) when 401 raise MnClient::NotAuthorized.new((env)) when 404 raise MnClient::NotFound.new((env)) when 400...500 raise MnClient::BadRequest.new((env)) end end |