Class: Mudfly::Response::HttpException
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Mudfly::Response::HttpException
- Defined in:
- lib/mudfly/response/http_exception.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(response) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mudfly/response/http_exception.rb', line 14 def on_complete(response) case response[:status].to_i when 400; raise Mudfly::Error::BadRequest.new(response[:body]) when 403; raise Mudfly::Error::Forbidden.new(response[:body]) when 500; raise Mudfly::Error::InternalServerError.new('Something gone wrong') when 503; raise Mudfly::Error::ServiceUnavailable.new('Impossible to handle the request') end end |