Tolerate errors in Atom feeds
This commit is contained in:
parent
ddceb20126
commit
6896e620ba
|
@ -17,6 +17,7 @@ use strict;
|
|||
use warnings;
|
||||
use v5.14;
|
||||
use Moose;
|
||||
use Try::Tiny;
|
||||
|
||||
use Cache::Memcached;
|
||||
use Encode qw(decode_utf8);
|
||||
|
@ -128,7 +129,13 @@ sub update {
|
|||
}
|
||||
} elsif ($self->{type} eq 'atom') {
|
||||
my $api = XML::Atom::Client->new();
|
||||
my $atomfeed = $api->getFeed($self->{url});
|
||||
my $atomfeed;
|
||||
try {
|
||||
# This doesn't work. XML::Atom::Client EXITS on error!
|
||||
$atomfeed = $api->getFeed($self->{url});
|
||||
} catch {
|
||||
$self->log->error("error fetching $self->{url}: $@");
|
||||
}
|
||||
if ($atomfeed) {
|
||||
my @items = $atomfeed->entries;
|
||||
for my $item (@items) {
|
||||
|
|
Loading…
Reference in New Issue