X Tutup
Skip to content

Commit 687a3b0

Browse files
committed
dispatcher: also break on errors in checkHandler
1 parent bf5ba9a commit 687a3b0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

telegram/ext/dispatcher.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,34 +172,32 @@ def processUpdate(self, update):
172172

173173
else:
174174
for group in self.handlers.values():
175-
handler_triggered = False
176-
177175
for handler in group:
178176
try:
179177
if handler.checkUpdate(update):
180-
handler_triggered = True
181178
handler.handleUpdate(update, self)
179+
break
182180
# Dispatch any errors
183181
except TelegramError as te:
184182
self.logger.warn(
185-
'Error was raised while processing Update.')
183+
'A TelegramError was raised while processing the '
184+
'Update.')
186185

187186
try:
188187
self.dispatchError(update, te)
189188
except:
190189
self.logger.exception(
191190
'An uncaught error was raised while '
192191
'handling the error')
192+
finally:
193+
break
193194

194195
# Errors should not stop the thread
195196
except:
196197
self.logger.exception(
197198
'An uncaught error was raised while '
198199
'processing the update')
199-
200-
finally:
201-
if handler_triggered:
202-
break
200+
break
203201

204202
def addHandler(self, handler, group=DEFAULT_GROUP):
205203
"""

0 commit comments

Comments
 (0)
X Tutup