Skip to content

Commit 8d9dfcf

Browse files
authored
Merge pull request #1707 from S1RANN/master
raise other exceptions in antiflood function
2 parents a1c77db + a06b4a1 commit 8d9dfcf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

telebot/util.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,15 @@ def antiflood(function: Callable, *args, **kwargs):
647647
"""
648648
from telebot.apihelper import ApiTelegramException
649649
from time import sleep
650-
msg = None
650+
651651
try:
652-
msg = function(*args, **kwargs)
652+
return function(*args, **kwargs)
653653
except ApiTelegramException as ex:
654654
if ex.error_code == 429:
655655
sleep(ex.result_json['parameters']['retry_after'])
656-
msg = function(*args, **kwargs)
657-
finally:
658-
return msg
656+
return function(*args, **kwargs)
657+
else:
658+
raise
659659

660660

661661
def parse_web_app_data(token: str, raw_init_data: str):

0 commit comments

Comments
 (0)