telebot
telebot copied to clipboard
v3: recovering panics obstructs error searching
Hi, I'm using telebot.v3
module to build some Telegram bots. On my development environment I set to true the Verbose
option to the bot, but when I run the bot and it panics it won't stop, instead it recovers the panics and prints an error message. This error message is not useful to understand where the bot panicked. I would suggest to add a new option that controls the deferred function inside runHandler on utils.go. I didn't open a pull request because there are multiple ways to solve this, maybe a discussion is needed.
I faced into a problem too. I think it's not the best idea to suppress panic from business logic, since it takes a lot of debugging time to guess that the problem is not visible due to the library.
@tucnak It's great if you could make panic forwarding more explicit or exclude "recover".
My proposal is to simply add an option #506
b.Use(middleware.Recover())
will be the new option to enable recover