mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-08 07:54:52 +00:00
Handle Telegram exceptions on start(). Fixes #121
The client doesn't need to be stopped as it never started successfully.
This commit is contained in:
parent
eb8513e009
commit
c75a4f182a
1 changed files with 25 additions and 20 deletions
|
|
@ -216,6 +216,7 @@ class Client(Methods, BaseClient):
|
||||||
self.session.start()
|
self.session.start()
|
||||||
self.is_started = True
|
self.is_started = True
|
||||||
|
|
||||||
|
try:
|
||||||
if self.user_id is None:
|
if self.user_id is None:
|
||||||
if self.token is None:
|
if self.token is None:
|
||||||
self.authorize_user()
|
self.authorize_user()
|
||||||
|
|
@ -238,6 +239,10 @@ class Client(Methods, BaseClient):
|
||||||
self.get_initial_dialogs_chunk()
|
self.get_initial_dialogs_chunk()
|
||||||
else:
|
else:
|
||||||
self.send(functions.updates.GetState())
|
self.send(functions.updates.GetState())
|
||||||
|
except Exception as e:
|
||||||
|
self.is_started = False
|
||||||
|
self.session.stop()
|
||||||
|
raise e
|
||||||
|
|
||||||
for i in range(self.UPDATES_WORKERS):
|
for i in range(self.UPDATES_WORKERS):
|
||||||
self.updates_workers_list.append(
|
self.updates_workers_list.append(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue