• It's been a longstanding annoyance for me that you can do something like:

    function test() {
      console.log(unknownVariable);
    }
    setInterval(test,100);
    

    and can generate a whole stream of exceptions on the console. It's not a big deal for USB-connected devices, but for Puck.js printing that amount of data swamps everything else.

    Generally this doesn't happen too much, but if you're changing code using the REPL and you make a typo in a function called from an interval then it's really annoying.

    At the moment, if you hit Ctrl-C a few times generally you can get it to cancel the interval with the error, but it's still a pain.

    Node.js cancels an interval the very first time there's an exception, but personally I don't think you want that because you might have some code in production that fails one in 100 times, but you want it to keep running regardless.

    Any thoughts on how to deal with this?

    • Espruino could detect exceptions and cancel the interval if there were 3 exceptions one after the other with no successfully completed one?
    • We could keep executing, but not report an exception if it was identical to the last one.
    • By default we could do what node.js does and kill any intervals that throw exceptions, and there could be an option to stop that behaviour. However I think 99.9% of people would keep the default behaviour, which would then make Espruino less reliable in production.
About

Avatar for Gordon @Gordon started