I am changing a plugin so as it works with a device source and several devices in it. The problem is that when a device is turned off the http.get call fails, shows a timeout and disconnects. I would like to catch this timeout to be able to skip that device and continue with the next one. I tried to use the “status” but the code never gets to that point, it always shows a timeout in the console.log before executing the “getSettings.status” shown below:
var getSettings = HttpGet(HostName, “settings”);
console.log("status getSettings = " + getSettings.status);
function HttpGet(HostName, attribute) {
return http.get(“http://” + HostName + “/” + attribute, {‘timeout’: 2000});
}
Could you please give me a hint about how to catch a timeout?
Thank you vey much.