intercom-ruby icon indicating copy to clipboard operation
intercom-ruby copied to clipboard

Injects rate_limit_details on RateLimitExceeded exception

Open diaclavijo opened this issue 2 months ago • 0 comments

Why?

This would allow a user of the API to rescue for example in an ApplicationJob and retry when the time has passed, rather than sleeping.

def perform
  req.execute(uri, token: 'test-token')
rescue Intercom::RateLimitExceeded => e
  self.class.perform_at(e.rate_limit_details[:reset_at])
end

How?

  • Adds attr_accessor to RateLimitExceeded on errors.rb
  • Intercom::Request#execute rescue block injects the @rate_limit_details before raising the exception

diaclavijo avatar Nov 03 '25 17:11 diaclavijo