Exception: Nombaone::RateLimitError

Inherits:
APIError show all
Defined in:
lib/nombaone/errors.rb,
sig/nombaone/errors.rbs

Overview

429 — slow down; retry after #retry_after seconds. The SDK retries these automatically, honoring Retry-After.

Constant Summary

Constants inherited from APIError

APIError::CLASS_FOR_STATUS, APIError::DEFAULT_CODE_FOR_STATUS

Instance Attribute Summary collapse

Attributes inherited from APIError

#code, #doc_url, #fields, #hint, #request_id, #status_code

Instance Method Summary collapse

Methods inherited from APIError

default_code_for_status, from_response

Constructor Details

#initialize(message, retry_after: nil, limit: nil, remaining: nil, **details) ⇒ RateLimitError

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RateLimitError.



243
244
245
246
247
248
# File 'lib/nombaone/errors.rb', line 243

def initialize(message, retry_after: nil, limit: nil, remaining: nil, **details)
  super(message, **details)
  @retry_after = retry_after
  @limit = limit
  @remaining = remaining
end

Instance Attribute Details

#limitInteger, ... (readonly)

Returns your request cap (X-RateLimit-Limit).

Returns:

  • (Integer, Float, nil)

    your request cap (X-RateLimit-Limit).



237
238
239
# File 'lib/nombaone/errors.rb', line 237

def limit
  @limit
end

#remainingInteger, ... (readonly)

Returns requests left in the window (X-RateLimit-Remaining).

Returns:

  • (Integer, Float, nil)

    requests left in the window (X-RateLimit-Remaining).



240
241
242
# File 'lib/nombaone/errors.rb', line 240

def remaining
  @remaining
end

#retry_afterInteger, ... (readonly)

Returns seconds until the rate-limit window rolls over (Retry-After).

Returns:

  • (Integer, Float, nil)

    seconds until the rate-limit window rolls over (Retry-After).



235
236
237
# File 'lib/nombaone/errors.rb', line 235

def retry_after
  @retry_after
end