Class: HTTPX::ErrorResponse

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/httpx/response.rb

Constant Summary

Constants included from Loggable

Loggable::COLORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loggable

#log

Constructor Details

#initialize(error, options) ⇒ ErrorResponse

Returns a new instance of ErrorResponse.



221
222
223
224
225
# File 'lib/httpx/response.rb', line 221

def initialize(error, options)
  @error = error
  @options = Options.new(options)
  log { "#{error.class}: #{error}" }
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



219
220
221
# File 'lib/httpx/response.rb', line 219

def error
  @error
end

Instance Method Details

#raise_for_statusObject

Raises:



231
232
233
# File 'lib/httpx/response.rb', line 231

def raise_for_status
  raise @error
end

#statusObject



227
228
229
# File 'lib/httpx/response.rb', line 227

def status
  @error.message
end