Class: Busibe::Error::RaiseClientError
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Busibe::Error::RaiseClientError
- Defined in:
- lib/busibe/error/raise_client_error.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/busibe/error/raise_client_error.rb', line 6 def on_complete(env) status = env[:status].to_i body = env[:body] headers = env[:response_headers] case status when 400 raise Busibe::Error::BadRequest.new body, headers when 403 raise Busibe::Error::Forbidden.new body, headers when 413 raise Busibe::Error::RequestTooLarge.new body, headers end end |