From 01557f1234c2d11aed0e945213c04282e015472a Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Sun, 15 Feb 2009 11:09:28 +0000 Subject: [PATCH] Better error checking - show actual exceptions when status field is not present, instead of just reporting that status was missing. --- aggregator.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aggregator.py b/aggregator.py index 83f9002..20de7f7 100755 --- a/aggregator.py +++ b/aggregator.py @@ -47,6 +47,13 @@ class Aggregator: numadded = 0 parsestart = datetime.datetime.now() feed = feedparser.parse(feedinfo[1], modified=feedinfo[3].timetuple()) + + if not hasattr(feed, 'status'): + # bozo_excpetion can seemingly be set when there is no error as well, + # so make sure we only check if we didn't get a status. + if hasattr(feed,'bozo_exception'): + raise Exception('Feed load error %s' % feed.bozo_exception) + raise Exception('Feed load error with not exception!') if feed.status == 304: # not changed -- 2.39.5