Add more informative error message when invoking disconnected

This commit is contained in:
Lonami Exo 2017-04-11 10:25:09 +02:00
parent 4fa43f231f
commit 1d2420d549

View File

@ -167,6 +167,9 @@ class TelegramClient:
if not issubclass(type(request), MTProtoRequest):
raise ValueError('You can only invoke MtProtoRequests')
if not self.sender:
raise ValueError('You must be connected to invoke requests!')
try:
self.sender.send(request)
self.sender.receive(request, timeout)