Class: Response::RaiseHttp4xx
- Inherits:
-
Middleware
- Object
- Middleware
- Response::RaiseHttp4xx
- Defined in:
- lib/faraday/response/raise_http_4xx.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/faraday/response/raise_http_4xx.rb', line 3 def on_complete(env) case env[:status].to_i when 400 raise "BadRequest-#{(env)}" when 401 raise "Unauthorized-#{(env)}" when 403 raise "Forbidden-#{(env)}" when 404 raise "NotFound-#{(env)}" when 406 raise "NotAcceptable-#{(env)}" when 420 raise "EnhanceYourCalm-#{(env)}" end end |