How to handle net::ERR_CONNECTION_REFUSED in app.request()

Hello, i have a problem with catching net::ERR_CONNECTION_REFUSED using ths code:

app.request({
        url: urlAuth,
        dataType: "json",
        data: {
                "username": username,
                "password": password
         },
        method: "POST",
        timeout: 8000,
        headers: headers,
        success: async function (result) {
                app.preloader.hide();
                database.addUser(name, orginalUrl, http, username, hash);
        },
        error: function (xhr, data, errorThrown) {
              console.log(xhr, data, errorThrown);
              console.log(data);
              app.preloader.hide();
       }
});

This error CONNECTION_REFUSED is returned when url we are calling dont exist. The error block is not fired. Can someone help?

Are you getting this error on a mobile device?

check the configuration to avoid server-side errors

Is this debugged on desktop or on device?