twitter-lite icon indicating copy to clipboard operation
twitter-lite copied to clipboard

Rate limit handling could be more explicit

Open lagoa89 opened this issue 4 years ago • 0 comments

First off thanks to you all for devloping such a helpful library. I really appreciate it.

I'm making a call to a users timeline to retrieve mentions. When the rate limit is hit twitter returns a 429 response with "Rate limit exceeded" in the body. Twitter-lite throws the following error: message: 'invalid json response body at https://api.twitter.com/2/users/****/mentions?tweet.fields=created_at%2Cauthor_id%2Cin_reply_to_user_id&max_results=100 reason: Unexpected token R in JSON at position 0', type: 'invalid-json'

It would be easier to handle this appropriately (e.g. exponential back-off) if the HTTP code was returned in the errors object.

I suspect twitter.js L104 is the reason this is thrown.

Please let me know if there is any more information you need. Thanks again.

lagoa89 avatar May 19 '21 14:05 lagoa89