Skip to content

Commit

Permalink
Clearer error when invoking without calling .connect() (#532)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Jan 11, 2018
1 parent 4f44121 commit 77ef659
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions telethon/telegram_bare_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,14 @@ def _invoke(self, call_receive, *requests):
except TimeoutError:
__log__.warning('Invoking timed out') # We will just retry

except ConnectionResetError:
except ConnectionResetError as e:
__log__.warning('Connection was reset while invoking')
if self._user_connected:
# Server disconnected us, __call__ will try reconnecting.
return None
else:
# 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
self._first_request = False
Expand Down

0 comments on commit 77ef659

Please sign in to comment.