Change Exception to Unauthorized when auth key not found

This commit is contained in:
KurimuzonAkuma 2024-07-08 16:05:55 +03:00
parent fd1fbbecc7
commit 31d6a28bbd

View File

@ -30,7 +30,7 @@ from pyrogram.connection import Connection
from pyrogram.crypto import mtproto
from pyrogram.errors import (
RPCError, InternalServerError, AuthKeyDuplicated, FloodWait, FloodPremiumWait, ServiceUnavailable, BadMsgNotification,
SecurityCheckMismatch
SecurityCheckMismatch, Unauthorized
)
from pyrogram.raw.all import layer
from pyrogram.raw.core import TLObject, MsgContainer, Int, FutureSalts
@ -307,9 +307,9 @@ class Session:
error_code = -Int.read(BytesIO(packet))
if error_code == 404:
raise Exception(
raise Unauthorized(
"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(