From f37c5c9f2f575d09811e0558643d29cea9845730 Mon Sep 17 00:00:00 2001 From: KurimuzonAkuma Date: Mon, 8 Jul 2024 16:05:55 +0300 Subject: [PATCH] Change Exception to Unauthorized when auth key not found Signed-off-by: wulan17 --- pyrogram/session/session.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index a6bc06d2..40625cfd 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -33,7 +33,7 @@ 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 @@ -310,9 +310,9 @@ class Session: 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" + 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." ) log.warning(