projects
/
twirssi-net-twitter-lite.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
89061e3
)
Add some additional evals to avoid lost terminal issues on twitter call failures
author
Dan Boger
<zigdon@irc.peeron.com>
Wed, 13 Jan 2010 19:22:19 +0000
(11:22 -0800)
committer
Dan Boger
<zigdon@irc.peeron.com>
Wed, 13 Jan 2010 19:22:19 +0000
(11:22 -0800)
twirssi.pl
patch
|
blob
|
history
diff --git
a/twirssi.pl
b/twirssi.pl
index 52343723a29d21d0994df5b12c7d79b3f475f4a7..5295231f8c07ede5bb0be5239227ab779679b4b2 100644
(file)
--- a/
twirssi.pl
+++ b/
twirssi.pl
@@
-430,7
+430,9
@@
sub cmd_logout {
return unless $data = &valid_username($data);
¬ice("Logging out $data...");
return unless $data = &valid_username($data);
¬ice("Logging out $data...");
- $twits{$data}->end_session();
+ eval {
+ $twits{$data}->end_session();
+ };
delete $twits{$data};
undef $twit;
if ( keys %twits ) {
delete $twits{$data};
undef $twit;
if ( keys %twits ) {
@@
-541,10
+543,19
@@
sub cmd_login {
}
unless ( $twit->authorized ) {
}
unless ( $twit->authorized ) {
+ eval {
+ my $url = $twit->get_authorization_url;
+ };
+
+ if ($@) {
+ ¬ice("ERROR: Failed to get OAuth authorization_url. Try again later.");
+ return;
+ }
+
¬ice("Twirssi not autorized to access $service for $user.");
¬ice("Please authorize at the following url, then enter the pin ");
¬ice("supplied with /twirssi_oauth $user\@$service <pin>");
¬ice("Twirssi not autorized to access $service for $user.");
¬ice("Please authorize at the following url, then enter the pin ");
¬ice("supplied with /twirssi_oauth $user\@$service <pin>");
- ¬ice($
twit->get_authorization_
url);
+ ¬ice($url);
$oauth{pending}{"$user\@$service"} = $twit;
return;
$oauth{pending}{"$user\@$service"} = $twit;
return;
@@
-1043,11
+1054,13
@@
sub get_updates {
sub do_updates {
my ( $fh, $username, $obj, $cache ) = @_;
sub do_updates {
my ( $fh, $username, $obj, $cache ) = @_;
- my $rate_limit = $obj->rate_limit_status();
- if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
- ¬ice("Rate limit exceeded for $username");
- return undef;
- }
+ eval {
+ my $rate_limit = $obj->rate_limit_status();
+ if ( $rate_limit and $rate_limit->{remaining_hits} < 1 ) {
+ ¬ice("Rate limit exceeded for $username");
+ return undef;
+ }
+ };
print scalar localtime, " - Polling for updates for $username" if &debug;
my $tweets;
print scalar localtime, " - Polling for updates for $username" if &debug;
my $tweets;