Raise exception if auth key not found

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
KurimuzonAkuma 2023-12-27 01:44:51 +03:00 committed by wulan17
parent 4795bdbd5b
commit 58f0031ead
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -309,6 +309,12 @@ class Session:
if packet: if packet:
error_code = -Int.read(BytesIO(packet)) error_code = -Int.read(BytesIO(packet))
if error_code == 404:
raise Exception(
"Auth key not found in the system. You must delete your session file"
"and log in again with your phone number or bot token"
)
log.warning( log.warning(
"Server sent transport error: %s (%s)", "Server sent transport error: %s (%s)",
error_code, Session.TRANSPORT_ERRORS.get(error_code, "unknown error") error_code, Session.TRANSPORT_ERRORS.get(error_code, "unknown error")