I have a promise function which unfortunately do not occur an error.. It is the Modbus-serial package. When I disconnect the rs485 connection I do not get an error.
Now I want to fire an error after one second when I do not get a response from the modbus promise.
const errHandling = setTimeout(async () => {
try {
// return new Error("Whoops!");
power = await hitachi.getFrequency();
console.log();
//clearTimeout(errHandling);
} catch (e) {
console.error(e);
}
}, 500);