Made more verbose exception handler for the bot for easier debugging
This commit is contained in:
parent
6bc8eb1413
commit
f4a5f51b23
@ -3,13 +3,13 @@ import functools
|
||||
from sqlalchemy.future import Engine
|
||||
from telebot.async_telebot import AsyncTeleBot
|
||||
|
||||
from . import callback_handlers, message_handlers
|
||||
from . import callback_handlers, exception_handler, message_handlers
|
||||
|
||||
__all__ = ["callback_handlers", "message_handlers"]
|
||||
__all__ = ["callback_handlers", "exception_handler", "message_handlers"]
|
||||
|
||||
|
||||
def create_bot(token: str, engine: Engine) -> AsyncTeleBot:
|
||||
bot = AsyncTeleBot(token)
|
||||
bot = AsyncTeleBot(token, exception_handler=exception_handler.Handler)
|
||||
bot.register_message_handler(
|
||||
functools.partial(message_handlers.set_master_password, bot, engine),
|
||||
commands=["set_master_pass"],
|
||||
|
8
src/bot/exception_handler.py
Normal file
8
src/bot/exception_handler.py
Normal file
@ -0,0 +1,8 @@
|
||||
import traceback
|
||||
from typing import Type
|
||||
|
||||
|
||||
class Handler:
|
||||
@staticmethod
|
||||
def handle(exc: Type[BaseException]) -> None:
|
||||
traceback.print_exception(exc)
|
Reference in New Issue
Block a user