Skip to content

RateLimit::Errors::LimitExceededError

Mohamed Motaweh edited this page Oct 4, 2022 · 1 revision

The RateLimit::Errors::LimitExceededError object has the following attributes

attribute/method Description
topic The given topic to the RateLimit.throttle(topic: ...) method
value The given value to the RateLimit.throttle(value: ...) method
threshold The threshold of the exceeded limit (Defaults to null)
interval The interval of the exceeded limit (Defaults to null)
result RateLimit::Result

Example

begin
  RateLimit.throttle(topic: :send_sms, value: id, raise_errors: true) do
    # Logic goes Here
  end
rescue RateLimit::Errors::LimitExceededError => e
  # Error Handling Logic goes here
  e.result    # RateLimit::Result Object
  e.topic     # 'send_sms'
  e.value     # id
  e.threshold # 2
  e.interval  # 60
end
Clone this wiki locally