Return ldap result code with error object