mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-22 05:54:18 +00:00
Catch Bad Gateway Telegram errors
This commit is contained in:
parent
762a672ce8
commit
22b63aa24f
1 changed files with 13 additions and 6 deletions
9
utils.py
9
utils.py
|
@ -128,7 +128,14 @@ def catch_telegram_errors(func):
|
|||
print(f"Network error while calling {func.__name__}(), retrying in 5 secs...")
|
||||
time.sleep(5)
|
||||
# Unknown error
|
||||
except telegram.error.TelegramError:
|
||||
except telegram.error.TelegramError as error:
|
||||
if error.message.lower() == "bad gateway":
|
||||
print(f"Bad Gateway while calling {func.__name__}(), retrying in 5 secs...")
|
||||
time.sleep(5)
|
||||
elif error.message.lower() == "timed out":
|
||||
print(f"Timed out while calling {func.__name__}(), retrying in 1 sec...")
|
||||
time.sleep(1)
|
||||
else:
|
||||
print(f"Telegram error while calling {func.__name__}(), retrying in 5 secs...")
|
||||
# Send the error to the Sentry server
|
||||
if sentry_client is not None:
|
||||
|
|
Loading…
Reference in a new issue