Class: HTTP::Features::RaiseError
- Inherits:
-
HTTP::Feature
- Object
- HTTP::Feature
- HTTP::Features::RaiseError
- Defined in:
- lib/http/features/raise_error.rb
Instance Method Summary collapse
-
#initialize(ignore: []) ⇒ RaiseError
constructor
A new instance of RaiseError.
- #wrap_response(response) ⇒ Object
Methods inherited from HTTP::Feature
Constructor Details
#initialize(ignore: []) ⇒ RaiseError
Returns a new instance of RaiseError.
6 7 8 9 10 |
# File 'lib/http/features/raise_error.rb', line 6 def initialize(ignore: []) super() @ignore = ignore end |
Instance Method Details
#wrap_response(response) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/http/features/raise_error.rb', line 12 def wrap_response(response) return response if response.code < 400 return response if @ignore.include?(response.code) raise HTTP::StatusError, response end |