mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 10:53:44 +03:00
Add additional asserts to debug issue with peer empty channels
This commit is contained in:
parent
52a247c156
commit
cb92a40156
|
@ -513,8 +513,13 @@ class UpdateMethods:
|
||||||
self._log[__name__].debug('Getting difference for entities '
|
self._log[__name__].debug('Getting difference for entities '
|
||||||
'for %r', update.__class__)
|
'for %r', update.__class__)
|
||||||
if channel_id:
|
if channel_id:
|
||||||
|
# There are reports where we somehow call get channel difference
|
||||||
|
# with `InputPeerEmpty`. Check our assumptions to better debug
|
||||||
|
# this when it happens.
|
||||||
|
assert isinstance(channel_id, int), 'channel_id was {}, not int in {}'.format(type(channel_id), update)
|
||||||
try:
|
try:
|
||||||
where = await self.get_input_entity(channel_id)
|
# Wrap the ID inside a peer to ensure we get a channel back.
|
||||||
|
where = await self.get_input_entity(types.PeerChannel(channel_id))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# There's a high chance that this fails, since
|
# There's a high chance that this fails, since
|
||||||
# we are getting the difference to fetch entities.
|
# we are getting the difference to fetch entities.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user