1
0
mirror of https://github.com/sjlongland/tornado-news.git synced 2025-09-13 18:13:16 +10:00

On error, dump the feed we tried to parse

Try to give more diagnostic information when a feed fails to be parsed.
This can be used to troubleshoot code later.
This commit is contained in:
Stuart Longland 2019-06-02 08:08:10 +10:00
parent d1acc132d2
commit 08221046a5
Signed by: stuartl
GPG Key ID: 6AA32EFB18079BAA

View File

@ -302,8 +302,13 @@ class FeedFetcher(object):
parsed = feedparser.parse(body)
# Extract the entries from the feed
try:
entries = list(map(partial(FeedEntry.from_entry, name),
parsed['entries']))
except:
self._log.error('Unhandled exception parsing entries:\n%s',
yaml.dump(parsed, default_flow_style=False))
raise
if not cached and (cache_dir is not None):
cache_out = yaml.safe_dump([e.raw for e in entries])