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, retries, options) ⇒ ErrorResponse

Returns a new instance of ErrorResponse.



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

def initialize(error, retries, options)
  @error = error
  @retries = retries
  @options = Options.new(options)
  log { "#{error.class}: #{error}" }
  log { caller.join("\n") }
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

#retriesObject (readonly)

Returns the value of attribute retries.



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

def retries
  @retries
end

Instance Method Details

#raise_for_statusObject

Raises:



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

def raise_for_status
  raise @error
end

#retryable?Boolean

Returns:

  • (Boolean)


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

def retryable?
  @retries.positive?
end

#statusObject



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

def status
  @error.message
end