From d76618622e64cd49fba9a917805ba9182d81a3db Mon Sep 17 00:00:00 2001 From: blank X Date: Fri, 11 Dec 2020 19:00:51 +0700 Subject: [PATCH] Change 'except Exception' to 'except BaseException' --- redditbot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/redditbot.py b/redditbot.py index 9b118ac..e70dcb7 100644 --- a/redditbot.py +++ b/redditbot.py @@ -63,7 +63,7 @@ async def main(): seen_posts = json.load(file) if isinstance(seen_posts, list): seen_posts = {'version': 0, 'chats': {'global': seen_posts}} - except Exception: + except BaseException: logging.exception('Loading JSON') seen_posts = {'version': 0, 'chats': {'global': []}} # chat dict: {chatid: [array of submission ids]} @@ -169,7 +169,7 @@ async def main(): for i in bot_admins: await client.send_message(i, f'{chat} timed out') break - except Exception: + except BaseException: give_ups.add(unique_id) logging.exception(chat) for i in bot_admins: @@ -177,7 +177,7 @@ async def main(): else: try: await _actual_start_post(random_post, [chat], cpp, show_nsfw_warning, show_spoilers_warning) - except Exception: + except BaseException: logging.exception(random_post.id) for i in bot_admins: await client.send_message(i, f'{random_post.id}\n{traceback.format_exc()}', parse_mode=None) @@ -431,7 +431,7 @@ async def main(): async def awrapper(e): try: await func(e) - except Exception: + except BaseException: await e.reply(traceback.format_exc(), parse_mode=None) raise return awrapper