Changeset 1020

Show
Ignore:
Timestamp:
06/30/06 06:06:18
Author:
miyagawa
Message:

Subscription::LivedoorReader?: Better error handling.
via http://d.hatena.ne.jp/sfujiwara/20060629/1151562692

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Subscription/LivedoorReader.pm

    r810 r1020  
    6868    $self->login_reader(); 
    6969 
    70     my $subs = $self->_request("/api/subs", { unread => 1 })
     70    my $subs = $self->_request("/api/subs", { unread => 1 }) || []
    7171 
    7272    for my $sub (@$subs) { 
    7373        $context->log(debug => "get unread items of $sub->{subscribe_id}"); 
    74         my $data = $self->_request("/api/unread", { subscribe_id => $sub->{subscribe_id} }); 
    75         $self->_request("/api/touch_all", { subscribe_id => $sub->{subscribe_id} }) 
    76             if $mark_read; 
     74        my $data = $self->_request("/api/unread", { subscribe_id => $sub->{subscribe_id} }) or next; 
    7775 
    7876        my $feed = Plagger::Feed->new; 
     
    105103        } 
    106104 
     105        $self->_request("/api/touch_all", { subscribe_id => $sub->{subscribe_id} }) 
     106            if $mark_read; 
     107 
    107108        $context->update->add($feed); 
    108109    } 
     
    149150    $self->{mech}->get($uri->as_string); 
    150151 
    151     return JSON::Syck::Load($self->{mech}->content); 
     152    if ($self->{mech}->status == 200) { 
     153        return JSON::Syck::Load($self->{mech}->content); 
     154    } 
     155 
     156    return; 
    152157} 
    153158