Better error checking - show actual exceptions when status field is
authorMagnus Hagander <magnus@hagander.net>
Sun, 15 Feb 2009 11:09:28 +0000 (11:09 +0000)
committerMagnus Hagander <magnus@hagander.net>
Sun, 15 Feb 2009 11:09:28 +0000 (11:09 +0000)
not present, instead of just reporting that status was missing.

aggregator.py

index 83f90026a0bda48834a1725319fc5c90863748f4..20de7f7590ecf6bc2540f83d9a85aeae18acdb6e 100755 (executable)
@@ -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