Class: Booqable::Middleware::RaiseError
- Defined in:
- lib/booqable/middleware/raise_error.rb
Overview
Faraday middleware that raises Booqable exceptions based on HTTP status codes
This middleware automatically converts HTTP error responses into appropriate Booqable exception classes. It inspects the response status code and body to determine the specific error type and raises the corresponding exception.
Instance Method Summary collapse
-
#on_complete(response) ⇒ void
Handle completed HTTP responses and raise exceptions for errors.
Instance Method Details
#on_complete(response) ⇒ void
This method returns an undefined value.
Handle completed HTTP responses and raise exceptions for errors
Called by Faraday after a response is received. Inspects the response and raises an appropriate Booqable exception if the status indicates an error. Successful responses are allowed to pass through unchanged.
24 25 26 |
# File 'lib/booqable/middleware/raise_error.rb', line 24 def on_complete(response) Booqable::Error.from_response(response) end |