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

How to handle connection errors? #68

Closed
babakyakhchali opened this issue Sep 6, 2017 · 2 comments
Closed

How to handle connection errors? #68

babakyakhchali opened this issue Sep 6, 2017 · 2 comments

Comments

@babakyakhchali
Copy link

Hi
how can network errors be handled? something like this:
Error: connect ECONNREFUSED 192.168.2.18:8021
constructor only gets a callback which is called after successful connection. but what if esl server is down or not reachable?

@englercj
Copy link
Owner

englercj commented Sep 6, 2017

Listen for the error event. It will emit anytime an error happens:

var conn = new esl.Connection(...);

conn.on('error', function (err) {
    // handle err
}

@englercj englercj closed this as completed Sep 6, 2017
@babakyakhchali
Copy link
Author

babakyakhchali commented Sep 7, 2017 via email

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

2 participants