Class: Response::RaiseApiError
- Inherits:
-
Middleware
- Object
- Middleware
- Response::RaiseApiError
- Defined in:
- lib/finix/response/finix_error_middleware.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(response) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/finix/response/finix_error_middleware.rb', line 7 def on_complete(response) status_code = response[:status].to_i error_class = Finix.errors_registry[status_code] raise Finix.errors_registry[:unknown].new response if error_class.nil? and status_code >= 400 raise error_class.new response if error_class end |