mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +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: ')
|
'Two step verification is enabled. Please enter your password: ')
|
||||||
code_ok = self.sign_in(password=pw)
|
code_ok = self.sign_in(password=pw)
|
||||||
else:
|
else:
|
||||||
raise e
|
raise
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Listen for updates
|
# Listen for updates
|
||||||
|
|
|
@ -84,7 +84,7 @@ class TcpClient:
|
||||||
partial = self.socket.recv(left_count)
|
partial = self.socket.recv(left_count)
|
||||||
writer.write(partial)
|
writer.write(partial)
|
||||||
|
|
||||||
except BlockingIOError:
|
except BlockingIOError as error:
|
||||||
# There was no data available for us to read. Sleep a bit
|
# There was no data available for us to read. Sleep a bit
|
||||||
time.sleep(self.delay)
|
time.sleep(self.delay)
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class TcpClient:
|
||||||
time_passed = datetime.now() - start_time
|
time_passed = datetime.now() - start_time
|
||||||
if time_passed > timeout:
|
if time_passed > timeout:
|
||||||
raise TimeoutError(
|
raise TimeoutError(
|
||||||
'The read operation exceeded the timeout.')
|
'The read operation exceeded the timeout.') from error
|
||||||
|
|
||||||
# If everything went fine, return the read bytes
|
# If everything went fine, return the read bytes
|
||||||
return writer.get_bytes()
|
return writer.get_bytes()
|
||||||
|
|
|
@ -173,7 +173,7 @@ class TelegramClient:
|
||||||
|
|
||||||
except InvalidDCError as error:
|
except InvalidDCError as error:
|
||||||
if throw_invalid_dc:
|
if throw_invalid_dc:
|
||||||
raise error
|
raise
|
||||||
|
|
||||||
self.reconnect_to_dc(error.new_dc)
|
self.reconnect_to_dc(error.new_dc)
|
||||||
return self.invoke(request, timeout=timeout, throw_invalid_dc=True)
|
return self.invoke(request, timeout=timeout, throw_invalid_dc=True)
|
||||||
|
@ -216,7 +216,7 @@ class TelegramClient:
|
||||||
print(error)
|
print(error)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
raise error
|
raise
|
||||||
elif password:
|
elif password:
|
||||||
salt = self.invoke(GetPasswordRequest()).current_salt
|
salt = self.invoke(GetPasswordRequest()).current_salt
|
||||||
result = self.invoke(
|
result = self.invoke(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user