But wouldn't responseStatus === 4xx indicate that the problem is on your end and retrying is unlikely to fix the issue. A 5xx is worth a retry, a 4xx should imho just produce an error message.
And even if you do retry, exponential backoff has been the standard for a long time (and is mentioned by the Twitter API documentation as a good solution to 429 responses)