mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
dispatcher: also break on errors in checkHandler
This commit is contained in:
parent
bf5ba9a369
commit
687a3b0ba1
1 changed files with 6 additions and 8 deletions
|
@ -172,17 +172,16 @@ class Dispatcher(object):
|
|||
|
||||
else:
|
||||
for group in self.handlers.values():
|
||||
handler_triggered = False
|
||||
|
||||
for handler in group:
|
||||
try:
|
||||
if handler.checkUpdate(update):
|
||||
handler_triggered = True
|
||||
handler.handleUpdate(update, self)
|
||||
break
|
||||
# Dispatch any errors
|
||||
except TelegramError as te:
|
||||
self.logger.warn(
|
||||
'Error was raised while processing Update.')
|
||||
'A TelegramError was raised while processing the '
|
||||
'Update.')
|
||||
|
||||
try:
|
||||
self.dispatchError(update, te)
|
||||
|
@ -190,16 +189,15 @@ class Dispatcher(object):
|
|||
self.logger.exception(
|
||||
'An uncaught error was raised while '
|
||||
'handling the error')
|
||||
finally:
|
||||
break
|
||||
|
||||
# Errors should not stop the thread
|
||||
except:
|
||||
self.logger.exception(
|
||||
'An uncaught error was raised while '
|
||||
'processing the update')
|
||||
|
||||
finally:
|
||||
if handler_triggered:
|
||||
break
|
||||
break
|
||||
|
||||
def addHandler(self, handler, group=DEFAULT_GROUP):
|
||||
"""
|
||||
|
|
Loading…
Add table
Reference in a new issue