Exception: Ffccmmx::HTTPXRetryableError

Inherits:
HTTPXError show all
Defined in:
lib/ffccmmx/exceptions.rb

Instance Attribute Summary

Attributes inherited from HTTPXError

#response

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HTTPXError

#initialize

Constructor Details

This class inherits a constructor from Ffccmmx::HTTPXError

Class Method Details

.retryable_error?(error) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
# File 'lib/ffccmmx/exceptions.rb', line 18

def self.retryable_error?(error)
  return false unless error.respond_to?(:response)
  return false if error.response.nil?

  RETRYABLE_STATUS_CODES.include?(error.response.status)
end

Instance Method Details

#retry_time(count: 1) ⇒ Object



25
26
27
28
# File 'lib/ffccmmx/exceptions.rb', line 25

def retry_time(count: 1)
  retry_seconds = response.headers["retry-after"] ? response.headers["retry-after"].to_i : 2**count
  Time.now + retry_seconds
end