ldap3
ldap3 copied to clipboard
Handling invalid server address
Hello.
Description case:
- creating the instance Server with invalid address (host)
- creating the instance Connection
- do the connection bind
- recived exception LDAPSocketOpenError with text 'invalid server address'
My concern:
When we call bind we appeal to open in base.py where scanning available addresses and try opened socket.
It is this place raised LDAPSocketOpenError.
The problem is that when we try to get the addresses (method candidate_addresses instance Server) we droped to address_infoin server.py.
We ignore all exception and return empty list. Next step we ignore empty address_info and return empty candidates (in candidate_addresses). Finally we ignored empty candidates and focus only on an empty list of exceptions.
- Why data not validating "right now"?
- Why no raising expetion if have problem now?
- In LDAPSocketOpenError not added invalid address
- Maybe should be better add custom exceptions for handling to type and not by substring?