Class: HTTPX::ErrorResponse
- Inherits:
-
Object
- Object
- HTTPX::ErrorResponse
- Extended by:
- Forwardable
- Includes:
- ErrorResponsePatternMatchExtensions, Loggable
- Defined in:
- lib/httpx/response.rb
Constant Summary
Constants included from Loggable
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #close ⇒ Object
- #finished? ⇒ Boolean
-
#initialize(request, error, options) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
- #raise_for_status ⇒ Object
- #status ⇒ Object
- #to_s ⇒ Object
Methods included from ErrorResponsePatternMatchExtensions
#deconstruct, #deconstruct_keys
Methods included from Loggable
Constructor Details
#initialize(request, error, options) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
353 354 355 356 357 358 359 |
# File 'lib/httpx/response.rb', line 353 def initialize(request, error, ) @request = request @response = request.response if request.response.is_a?(Response) @error = error @options = Options.new() log_exception(@error) end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
349 350 351 |
# File 'lib/httpx/response.rb', line 349 def error @error end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
349 350 351 |
# File 'lib/httpx/response.rb', line 349 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
349 350 351 |
# File 'lib/httpx/response.rb', line 349 def response @response end |
Instance Method Details
#close ⇒ Object
377 378 379 |
# File 'lib/httpx/response.rb', line 377 def close @response.close if @response.respond_to?(:close) end |
#finished? ⇒ Boolean
381 382 383 |
# File 'lib/httpx/response.rb', line 381 def finished? true end |
#raise_for_status ⇒ Object
385 386 387 |
# File 'lib/httpx/response.rb', line 385 def raise_for_status raise @error end |
#status ⇒ Object
361 362 363 364 |
# File 'lib/httpx/response.rb', line 361 def status warn ":#{__method__} is deprecated, use :error.message instead" @error. end |
#to_s ⇒ Object
367 368 369 |
# File 'lib/httpx/response.rb', line 367 def to_s @error.(highlight: false) end |