1
Fork 0
mirror of https://github.com/Steffo99/greed.git synced 2024-11-22 05:54:18 +00:00

Catch _all_ Bad Gateway Telegram errors

This commit is contained in:
Steffo 2018-04-26 08:16:39 +02:00
parent 22b63aa24f
commit a41728ba12

View file

@ -129,7 +129,7 @@ def catch_telegram_errors(func):
time.sleep(5) time.sleep(5)
# Unknown error # Unknown error
except telegram.error.TelegramError as error: except telegram.error.TelegramError as error:
if error.message.lower() == "bad gateway": if error.message.lower() in ["bad gateway", "invalid server response"]:
print(f"Bad Gateway while calling {func.__name__}(), retrying in 5 secs...") print(f"Bad Gateway while calling {func.__name__}(), retrying in 5 secs...")
time.sleep(5) time.sleep(5)
elif error.message.lower() == "timed out": elif error.message.lower() == "timed out":