Exception: ActiveSanction::HttpClient::ResponseError

Inherits:
Error show all
Extended by:
T::Sig
Defined in:
lib/active_sanction/http_client/errors.rb

Overview

Raised by Response#success! for a status the caller declared fatal. It carries the response, so a rescuer can still log what came back, and the status, so retryable? answers from it without anybody unwrapping the response to look: a 503 is retryable, a 403 for a missing User-Agent is not. See FetchError::RETRYABLE_STATUSES.

Instance Attribute Summary collapse

Attributes included from Error

#source_id, #status

Instance Method Summary collapse

Methods inherited from FetchError

#retryable?

Methods included from Error

#in_source, #retryable?, #to_h

Constructor Details

#initialize(response) ⇒ void

Which list this was is stamped on afterwards, by the adapter -- see Error#in_source. This layer has a URL and no idea what is behind it.

Parameters:

  • response (Response)


88
89
90
91
# File 'lib/active_sanction/http_client/errors.rb', line 88

def initialize(response)
  @response = T.let(response, Response)
  super("#{response.uri} returned #{response.status}", status: response.status)
end

Instance Attribute Details

#response ⇒ Response (readonly)

Returns:

  • (Response)


83
84
85
# File 'lib/active_sanction/http_client/errors.rb', line 83

def response
  @response
end