Handle AUTH_KEY_DUPLICATED error

This commit is contained in:
Dan 2018-06-28 00:16:12 +02:00
parent 38b7abec35
commit 6e4c608875

View File

@ -31,7 +31,7 @@ from pyrogram import __copyright__, __license__, __version__
from pyrogram.api import functions, types, core
from pyrogram.api.all import layer
from pyrogram.api.core import Message, Object, MsgContainer, Long, FutureSalt, Int
from pyrogram.api.errors import Error, InternalServerError
from pyrogram.api.errors import Error, InternalServerError, AuthKeyDuplicated
from pyrogram.connection import Connection
from pyrogram.crypto import AES, KDF
from .internals import MsgId, MsgFactory, DataCenter
@ -157,6 +157,9 @@ class Session:
self.ping_thread.start()
log.info("Connection inited: Layer {}".format(layer))
except AuthKeyDuplicated as e:
self.stop()
raise e
except (OSError, TimeoutError, Error):
self.stop()
except Exception as e: