Handle FileIdInvalidError in file transfers

This commit is contained in:
Tulir Asokan
2019-06-30 17:30:52 +03:00
parent 0710b4e8a1
commit 860b635188
+2 -2
View File
@@ -27,7 +27,7 @@ from telethon.tl.types import (Document, InputFileLocation, InputDocumentFileLoc
TypePhotoSize, PhotoSize, PhotoCachedSize, InputPhotoFileLocation,
InputPeerPhotoFileLocation)
from telethon.errors import (AuthBytesInvalidError, AuthKeyInvalidError, LocationInvalidError,
SecurityError)
SecurityError, FileIdInvalidError)
from mautrix_appservice import IntentAPI
from ..tgclient import MautrixTelegramClient
@@ -184,7 +184,7 @@ async def _unlocked_transfer_file_to_matrix(client: MautrixTelegramClient, inten
try:
file = await client.download_file(location)
except LocationInvalidError:
except (LocationInvalidError, FileIdInvalidError):
return None
except (AuthBytesInvalidError, AuthKeyInvalidError, SecurityError) as e:
log.exception(f"{e.__class__.__name__} while downloading a file.")