Handle unknown exceptions in getUpdates method

This commit is contained in:
Davte 2019-08-15 13:45:32 +02:00
parent 72a7dd5a5f
commit a2365f815d
2 changed files with 8 additions and 1 deletions

View File

@ -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"

View File

@ -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: