Skip to content

Commit

Permalink
Handle ServerError while getting difference
Browse files Browse the repository at this point in the history
Closes #3870.
  • Loading branch information
Lonami committed Sep 21, 2022
1 parent 49bdb76 commit c975b56
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions telethon/client/updates.py
Expand Up @@ -278,6 +278,11 @@ async def _update_loop(self: 'TelegramClient'):
self._log[__name__].info('Getting difference for account updates')
try:
diff = await self(get_diff)
except (errors.ServerError, ValueError) as e:
# Telegram is having issues
self._log[__name__].info('Cannot get difference since Telegram is having issues: %s', type(e).__name__)
self._message_box.end_difference()
continue
except (errors.UnauthorizedError, errors.AuthKeyError) as e:
# Not logged in or broken authorization key, can't get difference
self._log[__name__].info('Cannot get difference since the account is not logged in: %s', type(e).__name__)
Expand All @@ -295,6 +300,7 @@ async def _update_loop(self: 'TelegramClient'):
except (
errors.PersistentTimestampOutdatedError,
errors.PersistentTimestampInvalidError,
errors.ServerError,
errors.UnauthorizedError,
errors.AuthKeyError,
ValueError
Expand Down

0 comments on commit c975b56

Please sign in to comment.