client.bind() should not pass an error to the callback function before having tried to connect to all server urls
See original GitHub issueFirst, thanks for the great library! Also very cool that multiple server urls are supported now. Regarding this I ran into a problem.
I use the following code:
this.client.bind(
this.activeDirectoryConfig.username,
this.activeDirectoryConfig.password,
(error) => {
if (error) {
sharedLogger.error(
`Error in ActiveDirectoryClient.bindServiceUser() - ${error}`
);
reject(error);
} else {
resolve();
}
}
);
In case the client can not connect to the first server url in the array, the callback is called with an error. Later, when attempting to connect to the second server url, the callback is called again, this time without an error.
In my opinion the callback should not be called with an error before all server urls have been tried. Only if all attempts have failed, an error should be thrown.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Understanding Callback function in NodeJS - Stack Overflow
I am very new to Node Js and Concept of Callback Mechanism , I have working code to authenticate the User based on...
Read more >ldapjs Client API
Unbinding results in disconnecting the client regardless of whether a bind operation was performed. The callback argument is optional as unbind does not...
Read more >Paho Python MQTT Client - Working with Connections
A look at client connections and the Paho MQTT client. ... Create callback function on_connect(); Bind callback to callback function ...
Read more >Azure Functions error handling and retry guidance
Learn to handle errors and retry events in Azure Functions with links to specific binding errors, including information on retry policies.
Read more >Error handling in Node.js - LogRocket Blog
Deliver reliable software by learning how to handle errors in Node.js using callbacks, promises, and event emitters.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this is something we just plain forgot to address in https://github.com/ldapjs/node-ldapjs/pull/658
I am okay with a PR that:
I would only emit one error. This error could be a summary of all failed connection attempts:
“Error: Connection to ldap servers failed: [error of connection attempt to first server], [error of connection attempt to second server] …”