Skip to content

Error information when catch #1

@arielrahmane

Description

@arielrahmane

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions