Exception: ReveAI::RateLimitError

Inherits:
APIError show all
Defined in:
lib/reve_ai/errors.rb

Overview

Raised on 429 Too Many Requests responses.

Indicates the rate limit has been exceeded. Check #retry_after to determine when to retry.

Examples:

begin
  client.images.create(prompt: "A cat")
rescue ReveAI::RateLimitError => e
  sleep e.retry_after
  retry
end

Instance Attribute Summary

Attributes inherited from APIError

#body, #headers, #status

Instance Method Summary collapse

Methods inherited from APIError

#error_code, #initialize, #request_id

Constructor Details

This class inherits a constructor from ReveAI::APIError

Instance Method Details

#retry_afterInteger?

Returns the retry-after header value in seconds.

Indicates how long to wait before retrying the request.

Returns:

  • (Integer, nil)

    Seconds to wait before retrying



179
180
181
# File 'lib/reve_ai/errors.rb', line 179

def retry_after
  headers["retry-after"]&.to_i
end