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

Error information when catch #1

Open
arielrahmane opened this issue Oct 15, 2019 · 1 comment
Open

Error information when catch #1

arielrahmane opened this issue Oct 15, 2019 · 1 comment

Comments

@arielrahmane
Copy link

Is it possible to log the error in the catch to see where is the source of the failed internet connection?

In my case, it happens something really weird. It seems to enter both the .then and the .catch methods. But actually I'm having an internet connection (verified).

Here is the code:

var onlineCheck = function(timeout_, retires_, callback) {
    internetAvailable({
        // Provide maximum execution time for the verification
        timeout: timeout_,
        // If it tries 5 times and it fails, then it will throw no internet
        retries: retires_
    }).then(() => {
        console.log("INTERNET AVAILABLE");
        callback();
    }).catch(() => {
        console.log("NO INTERNET");
    });
}

function call from app.js:

InternetAv.onlineCheck(5000, 30, InternetAv.startTunnel());

I recieve both messages in the console: INTERNET AVAILABLE and NO INTERNET.

That's why I would like to know if there is a way to log more information when catching.
Thank you!

@bigdoor
Copy link

bigdoor commented Apr 3, 2021

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