mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-19 11:36:41 +00:00
Clearer error when invoking without calling .connect() (#532)
This commit is contained in:
parent
4f441219b1
commit
77ef659cbf
@ -508,14 +508,14 @@ class TelegramBareClient:
|
|||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
__log__.warning('Invoking timed out') # We will just retry
|
__log__.warning('Invoking timed out') # We will just retry
|
||||||
|
|
||||||
except ConnectionResetError:
|
except ConnectionResetError as e:
|
||||||
__log__.warning('Connection was reset while invoking')
|
__log__.warning('Connection was reset while invoking')
|
||||||
if self._user_connected:
|
if self._user_connected:
|
||||||
# Server disconnected us, __call__ will try reconnecting.
|
# Server disconnected us, __call__ will try reconnecting.
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
# User never called .connect(), so raise this error.
|
# User never called .connect(), so raise this error.
|
||||||
raise
|
raise RuntimeError('Tried to invoke without .connect()') from e
|
||||||
|
|
||||||
# Clear the flag if we got this far
|
# Clear the flag if we got this far
|
||||||
self._first_request = False
|
self._first_request = False
|
||||||
|
Loading…
Reference in New Issue
Block a user