These are some of the error codes that you may receive when creating direct
messages (aside from common error codes):

when the quota has run dry - HTTP 403 - "There was an error sending your
message: We know you have a lot to say, but you can only send so many direct
messages per day. (<a href="
http://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following";>click
here</a> for more info.)" (or something close to this, it may get truncated)

when it's not allowed due to the relationship - HTTP 403 - "You cannot send
messages to users who are not following you."

when it's too long - HTTP 403 - "The text of your direct message is over 140
characters."

missing parameters - HTTP 400 - "Invalid request."

when an unknown error occurs - HTTP 500 - "There was an error sending your
message."

It'd be best in your unit tests not to hit the API at all, but instead
provide mock API scenarios.

Taylor

On Wed, Jan 5, 2011 at 6:48 AM, Trevor Dean <trevord...@gmail.com> wrote:

> What's the best way to test limit detection code?  I want to make sure that
> when the DM limit or request limit is reached my code handles this properly.
>  I was wondering if there is a better way then just sending 250 DM's and
> then waiting for the error or making more than 150 requests/hour and then
> waiting for the error?  I don't want to raise any flags during my testing so
> I was wondering how you guy's test?
>
> Thanks,
>
> Trevor
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to