Class: Washbullet::HttpException
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Washbullet::HttpException
- Defined in:
- lib/washbullet/http_exception.rb
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/washbullet/http_exception.rb', line 10 def call(env) @app.call(env).on_complete do |response| exception = case response.status when 400 then Washbullet::BadRequest when 401 then Washbullet::Unauthorized when 402 then Washbullet::RequestFailed when 403 then Washbullet::Forbidden when 404 then Washbullet::NotFound when 500..505 then Washbullet::ServerError end raise exception, (response.body) if exception end end |