While draw() and mouseMoved() are similar, draw seems more fragile. When there is an error (e.g. reading property of undefined), draw() will crash and won't do any more drawing, while mouseMoved() will retry as soon as the mouse is moved. I would expect draw() to also retry at every "loop". See for instance this example:
Why is it? It would be nice if "draw" were more robust and tolerated failures.
--- Note from Pamela below:
That's a good observation, it is not bubbling the error up to the error buddy as we would hope. The error does fortunately show up in the JavaScript console, so it's not completely swallowed, but most new KA coders won't check the console.
While draw() and mouseMoved() are similar, draw seems more fragile. When there is an error (e.g. reading property of undefined), draw() will crash and won't do any more drawing, while mouseMoved() will retry as soon as the mouse is moved. I would expect draw() to also retry at every "loop". See for instance this example:
https://www.khanacademy.org/computer-programming/drawmousemoved/5746658043330560
Why is it? It would be nice if "draw" were more robust and tolerated failures.
--- Note from Pamela below:
That's a good observation, it is not bubbling the error up to the error buddy as we would hope. The error does fortunately show up in the JavaScript console, so it's not completely swallowed, but most new KA coders won't check the console.
This would be an issue with the open-source live-editor codebase: https://github.com/Khan/live-editor