semifor / Net-Twitter

A Perl interface to the Twitter APIs
83 stars 37 forks source link

Random Error message: "Status is over 140 characters. at twit.pl line 461" #68

Closed bulrush15 closed 7 years ago

bulrush15 commented 7 years ago

twit.pl is my program. But sometimes Net::Twitter sometimes exists with this error message and just quits. No idea why I'm getting the message as I check the length of all my tweets to make sure they are less than 160 ctrs before they are sent. And I can't debug into Net::Twitter to figure out the error. (If someone knows how to do this please let me know.) Besides I don't know when I'm going to get the error anyway because of the vague error msg.

Can you

semifor commented 7 years ago

When the Twitter API returns an error, Net::Twitter creates a Net::Twitter::Error object and throws it (with die). If you do nothing to handle the error, your script will exit and print the stringified error.

See Net::Twitter::Error for more information. Personally, I prefer Try::Tiny over eval.

There is also a stack_trace method that will return a Devel::StackTrace object so you can tell exactly where the error occured. I need to update the documentation.

Hope that helps.