mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Extend exception handler behaviour with middlewares
This commit is contained in:
parent
e689e968db
commit
124606fdcb
@ -3964,11 +3964,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
|
||||
self.exception_handler.handle(e)
|
||||
else: logging.error(str(e))
|
||||
|
||||
if middlewares:
|
||||
for middleware in middlewares:
|
||||
middleware.post_process(message, data, handler_error)
|
||||
|
@ -319,11 +319,10 @@ class AsyncTeleBot:
|
||||
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
|
||||
self.exception_handler.handle(e)
|
||||
else: logging.error(str(e))
|
||||
|
||||
|
||||
if middlewares:
|
||||
for middleware in middlewares:
|
||||
|
Loading…
Reference in New Issue
Block a user