Khan / live-editor

A browser-based live coding environment.
Other
762 stars 184 forks source link

Draw will crash on exception and not recover in Live Editor #707

Open diegoboston opened 5 years ago

diegoboston commented 5 years ago

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

diegoboston commented 5 years ago

By the way, to get the desired behavior, one could simple wrap draw() in a try/catch block.