summaryrefslogtreecommitdiffstats
path: root/lib/Crawl/Bot/Role
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-02-12 19:31:21 -0600
committerJesse Luehrs <doy@tozt.net>2010-02-12 19:31:21 -0600
commit4ccef75442e9b56054b2c7929542e422ee5d89f2 (patch)
treebc5926c033789196097daf06bf0525967b8ab1d5 /lib/Crawl/Bot/Role
parentf60edd672550c8dc45234266a5a22bb04f7b7674 (diff)
downloadcrawlbot-4ccef75442e9b56054b2c7929542e422ee5d89f2.tar.gz
crawlbot-4ccef75442e9b56054b2c7929542e422ee5d89f2.zip
better error handling
Diffstat (limited to 'lib/Crawl/Bot/Role')
-rw-r--r--lib/Crawl/Bot/Role/RSS.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Crawl/Bot/Role/RSS.pm b/lib/Crawl/Bot/Role/RSS.pm
index 8576a82..7a0177e 100644
--- a/lib/Crawl/Bot/Role/RSS.pm
+++ b/lib/Crawl/Bot/Role/RSS.pm
@@ -2,6 +2,7 @@ package Crawl::Bot::Role::RSS;
use Moose::Role;
use XML::RAI;
+use Try::Tiny;
with 'Crawl::Bot::Role::CachedItems';
@@ -9,7 +10,8 @@ requires 'rss_feed';
sub current_items {
my $self = shift;
- my $rss = XML::RAI->parse_uri($self->rss_feed);
+ my $rss = try { XML::RAI->parse_uri($self->rss_feed) } catch { warn $_ };
+ return unless ref($rss) eq 'ARRAY';
# after the XML::RAI object goes out of scope, the item objects become
# worthless. how dumb. capture the relevant data in some hashrefs instead.
return map {