Change 'except Exception' to 'except BaseException'
This commit is contained in:
parent
5a3a7eca51
commit
a2fe972793
|
@ -94,17 +94,17 @@ def log_errors(func):
|
|||
await func(client, *args)
|
||||
except (StopPropagation, ContinuePropagation):
|
||||
raise
|
||||
except Exception:
|
||||
except BaseException:
|
||||
tb = traceback.format_exc()
|
||||
try:
|
||||
await slave.send_message(config['config']['log_chat'], f'Exception occured in {func.__name__}\n\n{tb}', parse_mode=None)
|
||||
except Exception:
|
||||
except BaseException:
|
||||
logging.exception('Failed to log exception for %s as slave', func.__name__)
|
||||
tb = traceback.format_exc()
|
||||
for app in apps:
|
||||
try:
|
||||
await app.send_message(config['config']['log_chat'], f'Exception occured in {func.__name__}\n\n{tb}', parse_mode=None)
|
||||
except Exception:
|
||||
except BaseException:
|
||||
logging.exception('Failed to log exception for %s as app', func.__name__)
|
||||
tb = traceback.format_exc()
|
||||
else:
|
||||
|
@ -120,7 +120,7 @@ def public_log_errors(func):
|
|||
await func(client, message)
|
||||
except (StopPropagation, ContinuePropagation):
|
||||
raise
|
||||
except Exception:
|
||||
except BaseException:
|
||||
await message.reply_text(traceback.format_exc(), parse_mode=None)
|
||||
raise
|
||||
return wrapper
|
||||
|
|
|
@ -95,7 +95,7 @@ async def get_spamwatch(entity):
|
|||
async with session.get(f'https://api.spamwat.ch/banlist/{entity}', headers={'Authorization': f'Bearer {config["config"]["spamwatch_api"]}'}) as resp:
|
||||
try:
|
||||
json = await resp.json()
|
||||
except Exception as ex:
|
||||
except BaseException as ex:
|
||||
return f'- <b>{resp.status}:</b> {html.escape(type(ex).__name__)}: {html.escape(str(ex))}'
|
||||
if 'code' in json:
|
||||
return f'- <b>{json["code"]}:</b> {html.escape(json.get("error", ""))}'
|
||||
|
@ -156,7 +156,7 @@ async def get_cas(entity):
|
|||
async with session.get(f'https://api.cas.chat/check?user_id={entity}') as resp:
|
||||
try:
|
||||
json = await resp.json()
|
||||
except Exception as ex:
|
||||
except BaseException as ex:
|
||||
return f'- <b>{resp.status}:</b> {html.escape(type(ex).__name__)}: {html.escape(str(ex))}'
|
||||
if json['ok']:
|
||||
return f'''- <b>Banned on:</b> {str(datetime.datetime.fromisoformat(json["result"]["time_added"][:-1]))}
|
||||
|
@ -167,7 +167,7 @@ async def get_spam_protection(entity):
|
|||
async with session.get(f'https://api.intellivoid.net/spamprotection/v1/lookup?query={entity}') as resp:
|
||||
try:
|
||||
json = await resp.json()
|
||||
except Exception as ex:
|
||||
except BaseException as ex:
|
||||
return f'- <b>{resp.status}:</b> {html.escape(type(ex).__name__)}: {html.escape(str(ex))}'
|
||||
if json['success']:
|
||||
text = ''
|
||||
|
|
|
@ -19,7 +19,7 @@ async def ls(client, message):
|
|||
(folders if os.path.isdir(os.path.join(dir, i)) else files).append(i)
|
||||
except NotADirectoryError:
|
||||
text = f'<code>{html.escape(os.path.basename(dir))}</code>'
|
||||
except Exception as ex:
|
||||
except BaseException as ex:
|
||||
text = f'{type(ex).__name__}: {html.escape(str(ex))}'
|
||||
else:
|
||||
for i in folders:
|
||||
|
|
|
@ -40,7 +40,7 @@ async def info(client, message):
|
|||
entity = message.reply_to_message.from_user or message.reply_to_message.chat
|
||||
try:
|
||||
entity, entity_client = await get_entity(client, entity)
|
||||
except Exception as ex:
|
||||
except BaseException as ex:
|
||||
await message.reply_text(f'{type(ex).__name__}: {str(ex)}', parse_mode=None)
|
||||
return
|
||||
text_ping = _generate_sexy(entity, True)
|
||||
|
|
|
@ -32,7 +32,7 @@ def _generate(i):
|
|||
try:
|
||||
resp = requests.get('https://nekos.life/api/v2/endpoints')
|
||||
json = resp.json()
|
||||
except Exception:
|
||||
except BaseException:
|
||||
logging.exception('Cannot connect to nekos.life')
|
||||
else:
|
||||
for i in json:
|
||||
|
|
|
@ -76,7 +76,7 @@ async def whatanime(client, message):
|
|||
file.seek(0)
|
||||
try:
|
||||
await reply.reply_video(file.name, caption=f'{from_time} - {to_time}')
|
||||
except Exception:
|
||||
except BaseException:
|
||||
await reply.reply_text('Cannot send preview :/')
|
||||
await asyncio.gather(reply.edit_text(text, disable_web_page_preview=True), _send_preview())
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ def _generate(i):
|
|||
try:
|
||||
resp = requests.get('https://nekos.life/api/v2/endpoints')
|
||||
json = resp.json()
|
||||
except Exception:
|
||||
except BaseException:
|
||||
logging.exception('Cannot connect to nekos.life')
|
||||
else:
|
||||
for i in json:
|
||||
|
|
Loading…
Reference in New Issue