mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 21:07:59 +00:00
More readable exception handling
This commit is contained in:
parent
2f2a381686
commit
e69fea4bb5
@ -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…
x
Reference in New Issue
Block a user