mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 10:53:44 +03:00
Fix syntax of exception throwing here and there
This commit is contained in:
parent
7f787affc6
commit
0ef32a7d78
|
@ -64,7 +64,7 @@ class InteractiveTelegramClient(TelegramClient):
|
|||
'Two step verification is enabled. Please enter your password: ')
|
||||
code_ok = self.sign_in(password=pw)
|
||||
else:
|
||||
raise e
|
||||
raise
|
||||
|
||||
def run(self):
|
||||
# Listen for updates
|
||||
|
|
|
@ -84,7 +84,7 @@ class TcpClient:
|
|||
partial = self.socket.recv(left_count)
|
||||
writer.write(partial)
|
||||
|
||||
except BlockingIOError:
|
||||
except BlockingIOError as error:
|
||||
# There was no data available for us to read. Sleep a bit
|
||||
time.sleep(self.delay)
|
||||
|
||||
|
@ -93,7 +93,7 @@ class TcpClient:
|
|||
time_passed = datetime.now() - start_time
|
||||
if time_passed > timeout:
|
||||
raise TimeoutError(
|
||||
'The read operation exceeded the timeout.')
|
||||
'The read operation exceeded the timeout.') from error
|
||||
|
||||
# If everything went fine, return the read bytes
|
||||
return writer.get_bytes()
|
||||
|
|
|
@ -173,7 +173,7 @@ class TelegramClient:
|
|||
|
||||
except InvalidDCError as error:
|
||||
if throw_invalid_dc:
|
||||
raise error
|
||||
raise
|
||||
|
||||
self.reconnect_to_dc(error.new_dc)
|
||||
return self.invoke(request, timeout=timeout, throw_invalid_dc=True)
|
||||
|
@ -216,7 +216,7 @@ class TelegramClient:
|
|||
print(error)
|
||||
return False
|
||||
else:
|
||||
raise error
|
||||
raise
|
||||
elif password:
|
||||
salt = self.invoke(GetPasswordRequest()).current_salt
|
||||
result = self.invoke(
|
||||
|
|
Loading…
Reference in New Issue
Block a user