From 7de8ac60ed76f095fef77963e8ed1293e3cd23f3 Mon Sep 17 00:00:00 2001 From: Thomas Erlang Date: Wed, 4 Oct 2023 20:15:14 +0200 Subject: [PATCH] Display twitch request errors in chat --- tbot/twitch_bot/tasks/command.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tbot/twitch_bot/tasks/command.py b/tbot/twitch_bot/tasks/command.py index 3b3da7c..e5e1073 100644 --- a/tbot/twitch_bot/tasks/command.py +++ b/tbot/twitch_bot/tasks/command.py @@ -2,6 +2,7 @@ from tbot import logger from tbot.twitch_bot.bot_base import bot from tbot.twitch_bot import var_filler +from tbot.utils.twitch import Twitch_request_error cmds = [] _cmd_lookup = {} @@ -94,8 +95,10 @@ async def db_command(cmd, target, data): bot.send("PRIVMSG", target=target, message='@{}, {}'.format(data['display_name'], e)) except var_filler.Send_break: pass - except: - logger.exception('db_command') + except Twitch_request_error as e: + bot.send("PRIVMSG", target=target, message=str(e)) + except Exception as e: + logger.exception(str(e)) async def get_user_level(badges, user_id, channel_id, required_level): if 'broadcaster' in badges: