Skip to content

Commit 6e4c608

Browse files
committed
Handle AUTH_KEY_DUPLICATED error
1 parent 38b7abe commit 6e4c608

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

pyrogram/session/session.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from pyrogram.api import functions, types, core
3232
from pyrogram.api.all import layer
3333
from pyrogram.api.core import Message, Object, MsgContainer, Long, FutureSalt, Int
34-
from pyrogram.api.errors import Error, InternalServerError
34+
from pyrogram.api.errors import Error, InternalServerError, AuthKeyDuplicated
3535
from pyrogram.connection import Connection
3636
from pyrogram.crypto import AES, KDF
3737
from .internals import MsgId, MsgFactory, DataCenter
@@ -157,6 +157,9 @@ def start(self):
157157
self.ping_thread.start()
158158

159159
log.info("Connection inited: Layer {}".format(layer))
160+
except AuthKeyDuplicated as e:
161+
self.stop()
162+
raise e
160163
except (OSError, TimeoutError, Error):
161164
self.stop()
162165
except Exception as e:

0 commit comments

Comments
 (0)