Tolerate errors in Atom feeds
This commit is contained in:
parent
ddceb20126
commit
6896e620ba
|
@ -17,6 +17,7 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use v5.14;
|
use v5.14;
|
||||||
use Moose;
|
use Moose;
|
||||||
|
use Try::Tiny;
|
||||||
|
|
||||||
use Cache::Memcached;
|
use Cache::Memcached;
|
||||||
use Encode qw(decode_utf8);
|
use Encode qw(decode_utf8);
|
||||||
|
@ -128,7 +129,13 @@ sub update {
|
||||||
}
|
}
|
||||||
} elsif ($self->{type} eq 'atom') {
|
} elsif ($self->{type} eq 'atom') {
|
||||||
my $api = XML::Atom::Client->new();
|
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) {
|
if ($atomfeed) {
|
||||||
my @items = $atomfeed->entries;
|
my @items = $atomfeed->entries;
|
||||||
for my $item (@items) {
|
for my $item (@items) {
|
||||||
|
|
Loading…
Reference in New Issue