Class: HTTPX::ErrorResponse
- Inherits:
-
Object
- Object
- HTTPX::ErrorResponse
- Includes:
- 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.
Instance Method Summary collapse
-
#initialize(error, options) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
-
#method_missing(meth, &block) ⇒ Object
rubocop:disable Style/MissingRespondToMissing.
- #raise_for_status ⇒ Object
- #status ⇒ Object
Methods included from Loggable
Constructor Details
#initialize(error, options) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
243 244 245 246 247 |
# File 'lib/httpx/response.rb', line 243 def initialize(error, ) @error = error @options = Options.new() log_exception(@error) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, &block) ⇒ Object
rubocop:disable Style/MissingRespondToMissing
258 259 260 261 262 |
# File 'lib/httpx/response.rb', line 258 def method_missing(meth, *, &block) raise NoMethodError, "undefined response method `#{meth}' for error response" if Response.public_method_defined?(meth) super end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
241 242 243 |
# File 'lib/httpx/response.rb', line 241 def error @error end |
Instance Method Details
#raise_for_status ⇒ Object
253 254 255 |
# File 'lib/httpx/response.rb', line 253 def raise_for_status raise @error end |
#status ⇒ Object
249 250 251 |
# File 'lib/httpx/response.rb', line 249 def status @error. end |