From a2365f815d23c6540acdb313e673d99f25201ea0 Mon Sep 17 00:00:00 2001 From: Davte Date: Thu, 15 Aug 2019 13:45:32 +0200 Subject: [PATCH] Handle unknown exceptions in getUpdates method --- davtelepot/__init__.py | 2 +- davtelepot/bot.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index 8e76e7d..e3cb9b6 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -14,7 +14,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.2.8" +__version__ = "2.2.9" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/bot.py b/davtelepot/bot.py index 94bdd04..70a3997 100644 --- a/davtelepot/bot.py +++ b/davtelepot/bot.py @@ -2113,6 +2113,13 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject): ) await asyncio.sleep(error_cooldown) continue + elif isinstance(updates, Exception): + logging.error( + "Unexpected exception. " + f"Waiting {error_cooldown} seconds before trying again..." + ) + await asyncio.sleep(error_cooldown) + continue for update in updates: asyncio.ensure_future(self.route_update(update)) if update is not None: