Browse Source

Change 'except Exception' to 'except BaseException'

master
blank X 2 years ago
parent
commit
d76618622e
  1. 8
      redditbot.py

8
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

Loading…
Cancel
Save