diff --git a/sukuinote/__init__.py b/sukuinote/__init__.py index b9bef72..4353dd9 100644 --- a/sukuinote/__init__.py +++ b/sukuinote/__init__.py @@ -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 diff --git a/sukuinote/plugins/einfo.py b/sukuinote/plugins/einfo.py index 4332926..5b2aeb4 100644 --- a/sukuinote/plugins/einfo.py +++ b/sukuinote/plugins/einfo.py @@ -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'- {resp.status}: {html.escape(type(ex).__name__)}: {html.escape(str(ex))}' if 'code' in json: return f'- {json["code"]}: {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'- {resp.status}: {html.escape(type(ex).__name__)}: {html.escape(str(ex))}' if json['ok']: return f'''- Banned on: {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'- {resp.status}: {html.escape(type(ex).__name__)}: {html.escape(str(ex))}' if json['success']: text = '' diff --git a/sukuinote/plugins/files.py b/sukuinote/plugins/files.py index cb1a827..8e753dc 100644 --- a/sukuinote/plugins/files.py +++ b/sukuinote/plugins/files.py @@ -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'{html.escape(os.path.basename(dir))}' - except Exception as ex: + except BaseException as ex: text = f'{type(ex).__name__}: {html.escape(str(ex))}' else: for i in folders: diff --git a/sukuinote/plugins/info.py b/sukuinote/plugins/info.py index 3b6f2d3..1132c8c 100644 --- a/sukuinote/plugins/info.py +++ b/sukuinote/plugins/info.py @@ -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) diff --git a/sukuinote/plugins/nekos.py b/sukuinote/plugins/nekos.py index 7bddd3d..302d213 100644 --- a/sukuinote/plugins/nekos.py +++ b/sukuinote/plugins/nekos.py @@ -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: diff --git a/sukuinote/plugins/whatanime.py b/sukuinote/plugins/whatanime.py index be06a49..2a2f9ed 100644 --- a/sukuinote/plugins/whatanime.py +++ b/sukuinote/plugins/whatanime.py @@ -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()) diff --git a/sukuinote/slave-plugins/nekos.py b/sukuinote/slave-plugins/nekos.py index a2b5038..8493c71 100644 --- a/sukuinote/slave-plugins/nekos.py +++ b/sukuinote/slave-plugins/nekos.py @@ -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: