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

Trying to connect to an unreachable host doesn't always throw an error #143

Open
fbernhard opened this issue Jun 12, 2020 · 0 comments
Open

Comments

@fbernhard
Copy link

fbernhard commented Jun 12, 2020

This code should also check for "EHOSTUNREACH":

['ETIMEDOUT', 'ENOTFOUND', 'ECONNREFUSED'].indexOf(err.code) !== -1) {

if request throws an "EHOSTUNREACH" the system continues with the connection attempt which leads the library to "hang".

https://nodejs.org/api/os.html#os_signal_constants

Alternatively, maybe check for statusCode 200?

request(ariUrl, function (err, response) {
      if (err || !response || response.statusCode !== 200) {

Thank you!

@fbernhard fbernhard changed the title Trying to connect to an unreachable host doesn't always through an error Trying to connect to an unreachable host doesn't always throw an error Jun 12, 2020
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