mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Add more informative error message when invoking disconnected
This commit is contained in:
parent
4fa43f231f
commit
1d2420d549
|
@ -167,6 +167,9 @@ class TelegramClient:
|
||||||
if not issubclass(type(request), MTProtoRequest):
|
if not issubclass(type(request), MTProtoRequest):
|
||||||
raise ValueError('You can only invoke MtProtoRequests')
|
raise ValueError('You can only invoke MtProtoRequests')
|
||||||
|
|
||||||
|
if not self.sender:
|
||||||
|
raise ValueError('You must be connected to invoke requests!')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.sender.send(request)
|
self.sender.send(request)
|
||||||
self.sender.receive(request, timeout)
|
self.sender.receive(request, timeout)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user