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.



228
229
230
231
232
# File 'lib/httpx/response.rb', line 228

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.



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

def error
  @error
end

Instance Method Details

#raise_for_statusObject

Raises:



238
239
240
# File 'lib/httpx/response.rb', line 238

def raise_for_status
  raise @error
end

#statusObject



234
235
236
# File 'lib/httpx/response.rb', line 234

def status
  @error.message
end