Khan / Khan/live-editor

Draw will crash on exception and not recover in Live Editor

Open
#707 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
776
Forks
180
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the behavior with the linked drawmousemoved example and trace the live editor's draw loop and error handling. Check how mouseMoved() retries and whether errors reach the error buddy; done means draw() retries on each loop after an exception and the failure is surfaced there.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.