except and propagate TypeNotFoundError during update handling

This commit is contained in:
Lonami Exo 2023-05-03 17:55:38 +02:00
parent 9c7ac3b210
commit 2889bd5bf3

View File

@ -319,6 +319,13 @@ class UpdateMethods:
await self.disconnect()
break
continue
except errors.TypeNotFoundError as e:
# User is likely doing weird things with their account or session and Telegram gets confused as to what layer they use
self._log[__name__].warning('Cannot get difference since the account is likely misusing the session: %s', e)
self._message_box.end_difference()
self._updates_error = e
await self.disconnect()
break
except OSError as e:
# Network is likely down, but it's unclear for how long.
# If disconnect is called this task will be cancelled along with the sleep.
@ -354,6 +361,19 @@ class UpdateMethods:
await self.disconnect()
break
continue
except errors.TypeNotFoundError as e:
self._log[__name__].warning(
'Cannot get difference since the account is likely misusing the session: %s',
get_diff.channel.channel_id, e
)
self._message_box.end_channel_difference(
get_diff,
PrematureEndReason.TEMPORARY_SERVER_ISSUES,
self._mb_entity_cache
)
self._updates_error = e
await self.disconnect()
break
except (
errors.PersistentTimestampOutdatedError,
errors.PersistentTimestampInvalidError,