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
| ); | ||
|
|
||
| getErrorMessage().should("contain.text", "ValueError: boom in preload"); | ||
| getSkulptRunner().should("not.contain", "draw ran"); |
There was a problem hiding this comment.
Nice that this checks draw never runs - that’s the important bit for the stuck loading indicator
|
|
||
| for (const cb of Object.keys(callBacks)) { | ||
| if (Sk.globals[cb]) { | ||
| sketch[callBacks[cb]] = new Function( |
There was a problem hiding this comment.
Small note - not a blocker.
If preload, setup, or draw fails, we show the error and stop the sketch. If something like mouse_pressed fails, we still show the error but the sketch keeps running. Fine for this PR - might be worth matching later but I don't think it necessarily needs to be done on this PR
| // while trigger() is waiting for the element to become actionable, a | ||
| // wrapped element is detached for good and trigger() burns its full | ||
| // timeout; a query chain retries against the current element. | ||
| getHandle().trigger("mousedown", { button: 0, clientX, clientY }); |
There was a problem hiding this comment.
Nice fix - dropping cy.wrap($handle) and refinding the handle before mousedown is a good call.
The flake comes from a race - while we’re mid-drag (or even just waiting to start it), the app can rerender and replace the resize handle with a new DOM node. Cypress then keeps poking the old one until it times out. Requerying means we always hit the current handle, which should clear most of these failures. Waiting for #project-identifier before trusting the Run button is a good companion change for the same class of “element got swapped out underneath us” problem.
If this still flakes occasionally, we could harden a bit further without changing the app - e.g. wait until the handle’s position/size stops shifting before we drag, especially in the stacked layout test where things settle more slowly near the layout breakpoints. Happy to leave that until we see whether this is enough on its own


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