mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge pull request #1617 from coder2020official/bugfixes
Extended exception handler behaviour with middlewares for synchronous version as well
This commit is contained in:
commit
a3a55e7393
@ -4126,12 +4126,10 @@ class TeleBot:
|
||||
except Exception as e:
|
||||
handler_error = e
|
||||
|
||||
if not middlewares:
|
||||
if self.exception_handler:
|
||||
return self.exception_handler.handle(e)
|
||||
logging.error(str(e))
|
||||
return
|
||||
# remove the bot from data
|
||||
if self.exception_handler:
|
||||
self.exception_handler.handle(e)
|
||||
else: logging.error(str(e))
|
||||
|
||||
if middlewares:
|
||||
for middleware in middlewares:
|
||||
middleware.post_process(message, data, handler_error)
|
||||
|
@ -351,6 +351,7 @@ class AsyncTeleBot:
|
||||
if self.exception_handler:
|
||||
self.exception_handler.handle(e)
|
||||
else: logger.error(str(e))
|
||||
|
||||
|
||||
if middlewares:
|
||||
for middleware in middlewares:
|
||||
|
Loading…
Reference in New Issue
Block a user