telebot icon indicating copy to clipboard operation
telebot copied to clipboard

v3: recovering panics obstructs error searching

Open ema-pe opened this issue 2 years ago • 2 comments

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.

ema-pe avatar Oct 30 '21 16:10 ema-pe

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".

dzen-it avatar Dec 22 '21 17:12 dzen-it

My proposal is to simply add an option #506

Qusic avatar Apr 26 '22 04:04 Qusic

b.Use(middleware.Recover()) will be the new option to enable recover

demget avatar Sep 25 '22 08:09 demget