Improve ldap error handling

(cherry picked from commit 6ae2730947fbb8b0ca1f01435b5bf396089213d9)
1 file changed