Class: HTTPX::ErrorResponse
- Inherits:
-
Object
- Object
- HTTPX::ErrorResponse
- 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.
Instance Method Summary collapse
-
#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.
314 315 316 317 318 319 |
# File 'lib/httpx/response.rb', line 314 def initialize(request, error, ) @request = request @error = error @options = Options.new() log_exception(@error) end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
312 313 314 |
# File 'lib/httpx/response.rb', line 312 def error @error end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
312 313 314 |
# File 'lib/httpx/response.rb', line 312 def request @request end |
Instance Method Details
#raise_for_status ⇒ Object
337 338 339 |
# File 'lib/httpx/response.rb', line 337 def raise_for_status raise @error end |
#status ⇒ Object
321 322 323 324 |
# File 'lib/httpx/response.rb', line 321 def status warn ":#{__method__} is deprecated, use :error.message instead" @error. end |
#to_s ⇒ Object
327 328 329 |
# File 'lib/httpx/response.rb', line 327 def to_s @error.(highlight: false) end |