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)
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