diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py index 221a602c..e4f18a1e 100644 --- a/pyrogram/session/session.py +++ b/pyrogram/session/session.py @@ -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( - "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(