Change 'except Exception' to 'except BaseException'

This commit is contained in:
blank X 2020-12-11 19:00:51 +07:00
parent 76c45a45ea
commit d76618622e
1 changed files with 4 additions and 4 deletions

View File

@ -63,7 +63,7 @@ async def main():
seen_posts = json.load(file) seen_posts = json.load(file)
if isinstance(seen_posts, list): if isinstance(seen_posts, list):
seen_posts = {'version': 0, 'chats': {'global': seen_posts}} seen_posts = {'version': 0, 'chats': {'global': seen_posts}}
except Exception: except BaseException:
logging.exception('Loading JSON') logging.exception('Loading JSON')
seen_posts = {'version': 0, 'chats': {'global': []}} seen_posts = {'version': 0, 'chats': {'global': []}}
# chat dict: {chatid: [array of submission ids]} # chat dict: {chatid: [array of submission ids]}
@ -169,7 +169,7 @@ async def main():
for i in bot_admins: for i in bot_admins:
await client.send_message(i, f'{chat} timed out') await client.send_message(i, f'{chat} timed out')
break break
except Exception: except BaseException:
give_ups.add(unique_id) give_ups.add(unique_id)
logging.exception(chat) logging.exception(chat)
for i in bot_admins: for i in bot_admins:
@ -177,7 +177,7 @@ async def main():
else: else:
try: try:
await _actual_start_post(random_post, [chat], cpp, show_nsfw_warning, show_spoilers_warning) await _actual_start_post(random_post, [chat], cpp, show_nsfw_warning, show_spoilers_warning)
except Exception: except BaseException:
logging.exception(random_post.id) logging.exception(random_post.id)
for i in bot_admins: for i in bot_admins:
await client.send_message(i, f'{random_post.id}\n{traceback.format_exc()}', parse_mode=None) 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): async def awrapper(e):
try: try:
await func(e) await func(e)
except Exception: except BaseException:
await e.reply(traceback.format_exc(), parse_mode=None) await e.reply(traceback.format_exc(), parse_mode=None)
raise raise
return awrapper return awrapper