Class: DevinApi::Middleware::Response::RaiseError
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- DevinApi::Middleware::Response::RaiseError
- Defined in:
- lib/devin_api/middleware/response/raise_error.rb
Overview
Middleware for raising errors based on HTTP status
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/devin_api/middleware/response/raise_error.rb', line 8 def call(env) @app.call(env).on_complete do |response| handle_error_response(response) end rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e raise DevinApi::Error::ClientError, "Connection error: #{e.}" end |