diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-04-19 05:26:48 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-04-19 05:26:48 (GMT) |
commit | 5309fb20cb0ed8dba4bce2f93a6002f5d43708ca (patch) | |
tree | bf260c8862336fda1da1218ef6c49939643cddfe /rhautoimport-dn | |
parent | 1c34d6b5541d15df8eb983074023fb62149db54c (diff) |
improved error handling for RSS feed fetching
Diffstat (limited to 'rhautoimport-dn')
-rwxr-xr-x | rhautoimport-dn | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/rhautoimport-dn b/rhautoimport-dn index a8b9cbe..5b1bc63 100755 --- a/rhautoimport-dn +++ b/rhautoimport-dn @@ -94,8 +94,11 @@ my $yc = sprintf("%04d-%02d%02d", @broadcast_day); print "looking for files from date $y in RSS Feed\n"; print " -> $FILES_RSS_URL\n"; -my $files_feed = rhautoimport::fetch_parse_rss($FILES_RSS_URL) - or die "Error fetching feed: " . XML::Feed->errstr; +my ($files_feed, $errstr) = rhautoimport::fetch_parse_rss($FILES_RSS_URL); +unless (defined $files_feed) { + print "Error fetching feed: $errstr\n"; + exit 1; +} my $uri = ""; my $file = ""; @@ -139,8 +142,11 @@ if($uri eq "") { print "\nlooking for headlines from date $y in RSS Feed\n"; print " -> $HEADLINES_RSS_URL\n"; -my $headlines_feed = rhautoimport::fetch_parse_rss($HEADLINES_RSS_URL) - or die "Error fetching feed: " . XML::Feed->errstr; +my ($headlines_feed, $errstr) = rhautoimport::fetch_parse_rss($HEADLINES_RSS_URL); +unless (defined $headlines_feed) { + print "Error fetching feed: $errstr\n"; + exit 1; +} for my $entry ($headlines_feed->entries) { if($entry->enclosure && $entry->enclosure->type eq "audio/mpeg") { |