Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with 'connect ECONNREFUSED' issues #7

Open
ghost opened this issue Jan 11, 2017 · 1 comment
Open

Dealing with 'connect ECONNREFUSED' issues #7

ghost opened this issue Jan 11, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 11, 2017

When the server details you are connecting to are not correct, say, hostname or port etc are not valid, it manifests as a 'connect ECONNREFUSED' error and terminates the running process. For now, I am using process.on('uncaughtException', function (err) {} to catch this. With just the ldapjs library, seems like you can use the error event to catch this but how to best deal with this using the promised-ldap library?

@zerr0s
Copy link

zerr0s commented Feb 13, 2018

+1 same problem. I've added follwing code to index.js of the library to handle error on connection:

this.client.on('error', (e) => {
  throw e;
});

and use try/catch on the main code. Is there a better way ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant