mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +00:00
Make sure Session is always stopped upon exceptions in Client.get_file
This commit is contained in:
parent
debc459686
commit
11d0eb6ea1
@ -2696,13 +2696,17 @@ class Client:
|
|||||||
)
|
)
|
||||||
|
|
||||||
session.start()
|
session.start()
|
||||||
|
try:
|
||||||
session.send(
|
session.send(
|
||||||
functions.auth.ImportAuthorization(
|
functions.auth.ImportAuthorization(
|
||||||
id=exported_auth.id,
|
id=exported_auth.id,
|
||||||
bytes=exported_auth.bytes
|
bytes=exported_auth.bytes
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
except Exception as e:
|
||||||
|
session.stop()
|
||||||
|
raise e
|
||||||
|
|
||||||
else:
|
else:
|
||||||
session = Session(
|
session = Session(
|
||||||
dc_id,
|
dc_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user