Change Exception to Unauthorized when auth key not found

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
KurimuzonAkuma 2024-07-08 16:05:55 +03:00 committed by wulan17
parent 58f0031ead
commit f37c5c9f2f
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5

View file

@ -33,7 +33,7 @@ from pyrogram.errors import (
RPCError, InternalServerError, AuthKeyDuplicated, RPCError, InternalServerError, AuthKeyDuplicated,
FloodWait, FloodPremiumWait, FloodWait, FloodPremiumWait,
ServiceUnavailable, BadMsgNotification, ServiceUnavailable, BadMsgNotification,
SecurityCheckMismatch SecurityCheckMismatch, Unauthorized
) )
from pyrogram.raw.all import layer from pyrogram.raw.all import layer
from pyrogram.raw.core import TLObject, MsgContainer, Int, FutureSalts from pyrogram.raw.core import TLObject, MsgContainer, Int, FutureSalts
@ -310,9 +310,9 @@ class Session:
error_code = -Int.read(BytesIO(packet)) error_code = -Int.read(BytesIO(packet))
if error_code == 404: if error_code == 404:
raise Exception( raise Unauthorized(
"Auth key not found in the system. You must delete your session file" "Auth key not found in the system. You must delete your session file "
"and log in again with your phone number or bot token" "and log in again with your phone number or bot token."
) )
log.warning( log.warning(