Handle non-standard p5/py5 exceptions - #1561
Conversation
|
Do you know of any examples of p5 code that can cause this kind of error? I'm trying to understand if the error we show to the user would be clear in this cases (and that context would be useful to have in the PR) |
Thanks, Chris. I will add some more context to the PR note. I think it needs more investigating (perhaps along with other similar errors). |
…aspberryPiFoundation/editor-ui into 1652-handle-non-standard-p5-exceptions
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1683ad6. Configure here.
|
@copilot resolve the merge conflicts in this pull request |
…ard-p5-exceptions Co-authored-by: cocomarine <12242598+cocomarine@users.noreply.github.com>
Merge conflicts resolved — merged |
…aspberryPiFoundation/editor-ui into 1652-handle-non-standard-p5-exceptions
Closes RaspberryPiFoundation/digital-editor-issues#1652 ## Possible problem - Skulpt exceptions raised in p5/py5 sketches were escaping to window.onerror, reported by Sentry as the opaque "Non-Error exception captured with keys: $d, args, traceback". - The captured object is a Skulpt Python exception with an empty traceback (constructed in JS, e.g. p5's _friendlyError), thrown from an async p5 callback , so it never reached our error handling. ## Changes - Route preload/setup/draw (whole body, incl. the per-frame preamble) through Sk.uncaughtException, and stop the sketch (stopOnError) so a pre-canvas failure can't leave the draw loop running. - Harden handleError against non-standard exceptions (missing tp$str, empty traceback, no constructor). - Aslo fixed flaky tests in `spec-wc-resize.cy.js` by updating the helper file: - Hardened `dragHandle` to re-query the handle for trigger("mousedown") and made `loadPythonStarterProject` wait on #project-identifier so it resolves against the replacement <editor-wc> rather than the one about to be destroyed. > [!NOTE] > This is defensive hardening for the async-escape paths; the exact production trigger for EDITOR-UI-ABW was a private learner sketch and could not be reproduced. Behaviour is unchanged. _Generated with the help of Claude_ ## Further investigation - There are other similar errors (current error in the top row). - Need to investigate if they share the same route cause or are different problems. <img width="1199" height="494" alt="Screenshot 2026-08-05 at 11 34 56" src="https://github.com/user-attachments/assets/08cadfdc-62a6-4b63-9d07-66614fb10ce7" /> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>


Closes https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1652
Possible problem
Changes
spec-wc-resize.cy.jsby updating the helper file:dragHandleto re-query the handle for trigger("mousedown") and madeloadPythonStarterProjectwait on #project-identifier so it resolves against the replacement rather than the one about to be destroyed.Note
This is defensive hardening for the async-escape paths; the exact production trigger for EDITOR-UI-ABW was a private learner sketch and could not be reproduced. Behaviour is unchanged.
Generated with the help of Claude
Further investigation