From a41728ba12146ecc65641246643b1f7d8442078d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 26 Apr 2018 08:16:39 +0200 Subject: [PATCH] Catch _all_ Bad Gateway Telegram errors --- utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils.py b/utils.py index ff57176..df8c8ea 100644 --- a/utils.py +++ b/utils.py @@ -129,7 +129,7 @@ def catch_telegram_errors(func): time.sleep(5) # Unknown 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...") time.sleep(5) elif error.message.lower() == "timed out":