Skip to content

Commit

Permalink
Catch UPDATE_APP_TO_LOGIN in Telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
stijn-uva committed Jul 15, 2024
1 parent 04acc06 commit 346150b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion datasources/telegram/search_telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from datetime import datetime
from telethon import TelegramClient
from telethon.errors.rpcerrorlist import UsernameInvalidError, TimeoutError, ChannelPrivateError, BadRequestError, \
FloodWaitError, ApiIdInvalidError, PhoneNumberInvalidError
FloodWaitError, ApiIdInvalidError, PhoneNumberInvalidError, RPCError
from telethon.tl.functions.channels import GetFullChannelRequest
from telethon.tl.functions.users import GetFullUserRequest
from telethon.tl.types import User
Expand Down Expand Up @@ -940,6 +940,10 @@ def validate_query(query, request, user):
# wrong phone number
raise QueryParametersException(
"The phone number provided is not a valid phone number for these credentials.")
except RPCError as e:
# only seen this with an 'UPDATE_APP_TO_LOGIN' status
raise QueryParametersException(f"Could not verify your authentication. You may need to update your "
f"Telegram app(s) to the latest version to proceed ({e}).")
except Exception as e:
# ?
raise QueryParametersException(
Expand Down

0 comments on commit 346150b

Please sign in to comment.