From e89ab76a671bbbe2dc86121f8a0d5738fa21adfc Mon Sep 17 00:00:00 2001 From: kaliko Date: Fri, 23 Oct 2020 16:14:26 +0200 Subject: [PATCH] feeds: catch urllib.error.URLError to avoid killing thread --- sid/feeds.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sid/feeds.py b/sid/feeds.py index 9dc7ea1..7fe5825 100644 --- a/sid/feeds.py +++ b/sid/feeds.py @@ -19,6 +19,8 @@ import threading import time import traceback +from urllib.error import URLError + from feedparser import parse as feed_parse from .plugin import Plugin, botcmd @@ -122,7 +124,9 @@ class FeedMonitor(threading.Thread): for feed in self.feeds_list: try: self.new_posts(feed) - except Exception as err: + except URLError as err: # Non fatal exception + self.plugin.log.error(f'error for {feed}: {err.reason}') + except Exception as err: # Unknown execption, killing thread anyway self.plugin.log.error('feeds thread crashed: %s', err) self.plugin.log.error(''.join(traceback.format_exc())) self.thread_killed = True -- 2.39.5