File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 23
23
from telethon .errors import (
24
24
AuthKeyDuplicatedError ,
25
25
AuthKeyError ,
26
+ AuthKeyNotFound ,
26
27
RPCError ,
27
28
TakeoutInitDelayError ,
28
29
UnauthorizedError ,
@@ -215,7 +216,7 @@ async def ensure_started(self, even_if_no_session=False) -> User:
215
216
async with self ._ensure_started_lock :
216
217
return cast (User , await super ().ensure_started (even_if_no_session ))
217
218
218
- async def on_signed_out (self , err : UnauthorizedError | AuthKeyError ) -> None :
219
+ async def on_signed_out (self , err : UnauthorizedError | AuthKeyError | AuthKeyNotFound ) -> None :
219
220
error_code = "tg-auth-error"
220
221
if isinstance (err , AuthKeyDuplicatedError ):
221
222
error_code = "tg-auth-key-duplicated"
@@ -236,8 +237,8 @@ async def on_signed_out(self, err: UnauthorizedError | AuthKeyError) -> None:
236
237
async def start (self , delete_unless_authenticated : bool = False ) -> User :
237
238
try :
238
239
await super ().start ()
239
- except AuthKeyDuplicatedError as e :
240
- self .log .warning ("Got AuthKeyDuplicatedError in start()" )
240
+ except ( AuthKeyDuplicatedError , AuthKeyNotFound ) as e :
241
+ self .log .warning (f "Got { type ( e ). __name__ } in start()" )
241
242
await self .on_signed_out (e )
242
243
if not delete_unless_authenticated :
243
244
# The caller wants the client to be connected, so restart the connection.
You can’t perform that action at this time.
0 commit comments