internet-available icon indicating copy to clipboard operation
internet-available copied to clipboard

Error information when catch

Open arielrahmane opened this issue 6 years ago • 1 comments

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!

arielrahmane avatar Oct 15 '19 21:10 arielrahmane

#1 @https://j-freeslotonline.blogspot.com/?m=1`

bigdoor avatar Apr 03 '21 12:04 bigdoor