I've been testing potential behaviour of my app when an authenticated user of twitter is near their rate limit. I'm finding the TwitterTemplate is returning an OperationNotPermittedException rather than an expected RateLimitException.
Is this normal behaviour?
At the moment I'm having to wrap my status update call as follows:
This seems a bif naff... Does anyone have any other suggestions??
catch (OperationNotPermittedException e)
if (e.getMessage().contains("User is over daily status update limit"))
throw new RateLimitExceededException();
I'm not particularly comfortable with the idea of parsing the message text of an exception to decide whether to rethrow it.
To give some context to this; if a status update fails, in most cases I plan to throw it away, but for 'rate limit reached, I'll place that message back on a queue for a delayed delivery (determined by the new RateLimitStatus object).