I found an error in some of my code (I was failing to trap a case where a sensor was returning 0), that caused devices to hang, requiring a power cycle.
`
function test1()
{
return 1.0*0/0;
}
function test2()
{
return 1.0*1/0;
}
function test3()
{
return 1*1/0;
}
server.log(test1());
`
The above code logs ‘0’ and the device stays online. It doesn’t throw a divide by zero error, because of the float multiplication.
However, if I run function test2(), the device hangs and becomes unresponsive, requiring a power cycle to download new firmware. I understand one should never divide by zero, but it’d be nice if an error was logged (as is the case for integer divide by zero in test3) rather than the device becoming un-contactable.