mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-08 07:54:52 +00:00
More readable exception handling
This commit is contained in:
parent
2f2a381686
commit
e69fea4bb5
1 changed files with 7 additions and 7 deletions
|
|
@ -802,15 +802,15 @@ class Client:
|
||||||
Raises:
|
Raises:
|
||||||
:class:`Error <pyrogram.Error>`
|
:class:`Error <pyrogram.Error>`
|
||||||
"""
|
"""
|
||||||
if self.is_started:
|
if not self.is_started:
|
||||||
|
raise ConnectionError("Client has not been started")
|
||||||
|
|
||||||
r = self.session.send(data)
|
r = self.session.send(data)
|
||||||
|
|
||||||
self.fetch_peers(getattr(r, "users", []))
|
self.fetch_peers(getattr(r, "users", []))
|
||||||
self.fetch_peers(getattr(r, "chats", []))
|
self.fetch_peers(getattr(r, "chats", []))
|
||||||
|
|
||||||
return r
|
return r
|
||||||
else:
|
|
||||||
raise ConnectionError("client '{}' is not started".format(self.session_name))
|
|
||||||
|
|
||||||
def load_config(self):
|
def load_config(self):
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue