Ignore:
Timestamp:
Jul 21, 2009, 10:06:32 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
82fd1e6
Parents:
7430aa4
Message:
Better error handling for invalid credentials in the main module.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/BarnOwl/Module/Twitter.pm

    r159aaad rd748296  
    2323use BarnOwl::Module::Twitter::Handle;
    2424
    25 our @twitter_handles;
    26 our $default_handle;
     25our @twitter_handles = ();
     26our $default_handle = undef;
    2727my $user     = BarnOwl::zephyr_getsender();
    2828my ($class)  = ($user =~ /(^[^@]+)/);
     
    114114    }
    115115
    116     my $twitter_handle = BarnOwl::Module::Twitter::Handle->new($cfg, %$twitter_args);
    117     push @twitter_handles, $twitter_handle;
    118     $default_handle = $twitter_handle if (!defined $twitter_handle && exists $cfg->{default_sender} && $cfg->{default_sender});
     116    eval {
     117        my $twitter_handle = BarnOwl::Module::Twitter::Handle->new($cfg, %$twitter_args);
     118        push @twitter_handles, $twitter_handle;
     119        $default_handle = $twitter_handle if (!defined $twitter_handle && exists $cfg->{default_sender} && $cfg->{default_sender});
     120    };
    119121}
    120122
     
    140142
    141143sub poll_messages {
     144    return unless @twitter_handles;
     145
    142146    my $handle = $twitter_handles[$next_service_to_poll];
    143147    $next_service_to_poll = ($next_service_to_poll + 1) % scalar(@twitter_handles);
Note: See TracChangeset for help on using the changeset viewer.