Open EnzoRobaina opened 7 months ago
I think it's possible. Working on it now.
@EnzoRobaina What you can do in the time being is, while creating an instance of Rettiwt
, you can pass a custom error handler class which implements the IErrorHandler
interface. Then handle
method can be implemented such that on Error 429, it returns the retry after value.
The implemented error handler can be passed as follows:
// 'CustomErrorHandler' is the class written by you that implements 'IErrorHandler' interface
const handler = new CustomErrorHandler();
const rettiwt = new Rettiwt({ apiKey: API_KEY, errorHandler: handler });
Thats great! Thanks for the quick reply!
Would it be possible to return how much time must be waited before trying again? This would be very useful when using in conjunction with some backoff/retry implementations
My suggestion for the error object, given that Twitter does provide this info:
{ message: 'TOO_MANY_REQUESTS', status: 429, stack: '...', retryAfter: 2000, }