2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-30 13:57:54 +00:00

Add extra warnings when sign-ins or sign-ups fail

This commit is contained in:
Dan
2018-12-18 11:21:37 +01:00
parent c9bcf93cf7
commit bc824f738c

View File

@@ -538,21 +538,10 @@ class Client(Methods, BaseClient):
) )
) )
except PhoneNumberUnoccupied: except PhoneNumberUnoccupied:
print("PHONE NON-OCCUPIED") log.warning("Phone number unregistered")
phone_registered = False phone_registered = False
continue continue
else: else:
try:
self.send(
functions.auth.SignIn(
self.phone_number,
phone_code_hash,
self.phone_code
)
)
except PhoneNumberUnoccupied:
pass
self.first_name = self.first_name if self.first_name is not None else input("First name: ") self.first_name = self.first_name if self.first_name is not None else input("First name: ")
self.last_name = self.last_name if self.last_name is not None else input("Last name: ") self.last_name = self.last_name if self.last_name is not None else input("Last name: ")
@@ -567,7 +556,7 @@ class Client(Methods, BaseClient):
) )
) )
except PhoneNumberOccupied: except PhoneNumberOccupied:
print("PHONE OCCUPIED") log.warning("Phone number already registered")
phone_registered = True phone_registered = True
continue continue
except (PhoneCodeInvalid, PhoneCodeEmpty, PhoneCodeExpired, PhoneCodeHashEmpty) as e: except (PhoneCodeInvalid, PhoneCodeEmpty, PhoneCodeExpired, PhoneCodeHashEmpty) as e: