Exception: Apertur::RateLimitError

Inherits:
Error
  • Object
show all
Defined in:
lib/apertur/errors.rb

Overview

Raised when the API returns a 429 Too Many Requests response.

Instance Attribute Summary collapse

Attributes inherited from Error

#code, #status_code

Instance Method Summary collapse

Constructor Details

#initialize(message = "Rate limit exceeded", retry_after: nil) ⇒ RateLimitError

Returns a new instance of RateLimitError.

Parameters:

  • message (String) (defaults to: "Rate limit exceeded")

    the error message

  • retry_after (Integer, nil) (defaults to: nil)

    seconds to wait before retrying



43
44
45
46
# File 'lib/apertur/errors.rb', line 43

def initialize(message = "Rate limit exceeded", retry_after: nil)
  super(message, status_code: 429, code: "RATE_LIMIT")
  @retry_after = retry_after
end

Instance Attribute Details

#retry_afterInteger? (readonly)

seconds to wait before retrying

Returns:

  • (Integer, nil)

    the current value of retry_after



38
39
40
# File 'lib/apertur/errors.rb', line 38

def retry_after
  @retry_after
end