Improve friendly error message#1487
Open
cocomarine wants to merge 64 commits into
Open
Conversation
Closed
…icitly rawTraceback contains `<exec>` instead of `main.py` as the filename, for example, we can now override the filename passed to friendlyExplain()
…iFoundation/editor-ui into 1448-and-ui-branches-combined
PFEM 0.6.0 markup has improved accessibility attributes, such as aria labels and roles. Has no effect on the styling (since classes, and the markup as a whole, remain the same).
…iFoundation/editor-ui into 1448-and-ui-branches-combined
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Python error UI to support pfem v0.7.0 “friendly” error messages, and repositions error display so it appears in the input panel (and appropriately in output-only mode), including mobile tab-selection behavior.
Changes:
- Bumps
@raspberrypifoundation/python-friendly-error-messagesto0.7.0and updates runners to use the new adapter +sections: ["title","summary"]. - Introduces
FriendlyErrorMessageand refactorsErrorMessagestyling/markup; movesErrorMessagerendering intoEditorInput. - Adds/updates unit + Cypress coverage for friendly errors and mobile error-tab selection.
Reviewed changes
Copilot reviewed 25 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.yarnrc.yml |
Pre-approves the pfem package for Yarn’s restricted installs. |
package.json |
Bumps pfem dependency to 0.7.0. |
yarn.lock |
Lockfile update for pfem 0.7.0. |
src/web-component.html |
Web component test page formatting tweaks and attribute changes. |
src/utils/setupTests.js |
Updates Jest mock exports for pfem adapter changes. |
src/PyodideWorker.js |
Adds rawTraceback to worker error payload for friendlier parsing. |
src/components/Mobile/MobileProject/MobileProject.jsx |
Switches mobile tabs to input when Python errors occur after running. |
src/components/Mobile/MobileProject/MobileProject.test.js |
Adds tests for mobile error display/tab selection. |
src/components/Editor/Runners/PythonRunner/SkulptRunner/SkulptRunner.jsx |
Updates pfem adapter usage and friendlyExplain options; removes runner-local ErrorMessage rendering. |
src/components/Editor/Runners/PythonRunner/SkulptRunner/SkulptRunner.test.js |
Removes outdated error-message placement tests. |
src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.jsx |
Updates pfem adapter usage; uses rawTraceback; shows ErrorMessage only in output-only mode. |
src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideRunner.test.js |
Updates error message expectations and adds friendly-error edge case tests. |
src/components/Editor/FriendlyErrorMessage/FriendlyErrorMessage.jsx |
New component to render sanitized friendly error HTML. |
src/components/Editor/FriendlyErrorMessage/FriendlyErrorMessage.test.js |
New tests for friendly error rendering + sanitization. |
src/components/Editor/ErrorMessage/ErrorMessage.jsx |
Refactors error UI markup; embeds FriendlyErrorMessage and icon. |
src/components/Editor/ErrorMessage/ErrorMessage.test.js |
Updates assertions for new class naming. |
src/components/Editor/EditorInput/EditorInput.jsx |
Renders ErrorMessage at the bottom of the input panel (above Run). |
src/components/Editor/EditorInput/EditorInput.test.js |
Adds a test asserting error message appears in EditorInput. |
src/assets/stylesheets/InternalStyles.scss |
Includes FriendlyErrorMessage styles in internal stylesheet bundle. |
src/assets/stylesheets/FriendlyErrorMessage.scss |
New styling for pfem HTML elements (title/summary/code/file/line). |
src/assets/stylesheets/ErrorMessage.scss |
Updates styling and class structure for new ErrorMessage layout. |
src/assets/stylesheets/EditorPanel.scss |
Formatting/cleanup only. |
src/assets/icons/cancel_FILL.svg |
New icon used in ErrorMessage header row. |
src/assets/error_file.svg |
New asset used to decorate file references in friendly errors. |
cypress/helpers/editor.js |
Updates selectors and adds helper for friendly error message container. |
cypress/fixtures/copydeck.json |
Adds a fixture copydeck for deterministic friendly-error Cypress tests. |
cypress/e2e/spec-wc-skulpt.cy.js |
Adds Cypress coverage for friendly errors in Skulpt. |
cypress/e2e/spec-wc-pyodide.cy.js |
Adds Cypress coverage for friendly errors in Pyodide. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
❗ This branch was created by rebasing #1485 to #1483.
Decisions made upon adding pfem v. 0.7.0
titleandsummaryof friendly errors (potentiallywhybit might also be added later on)ErrorMessagenow optionally includesFriendlyErrorMessageErrorMessageto the bottom of input panel above Run buttonMobileProject), when the error is triggered after run, the input panel becomes the selected tab so that users can see the error (if no error triggered, the output panel becomes selected)WebcomponentProject.jsx, EditorInput is not rendered at all in output only mode, resulting inErrorMessagedisplayed only by Output panel of Pyodidemain.pyshows first.main.py, they will show (one at a time).WIP and future pfem
whyof friendly error in terms of copy and UIScreen recordings of editor with friendly messages
Multiple python files
https://github.com/user-attachments/assets/a70727a4-121a-4c05-859f-f60f2cc29046
Responsiveness
https://github.com/user-attachments/assets/6697cfd4-fca9-4c04-af66-92b181a8e34d
Mobile screen (< 600 px)
https://github.com/user-attachments/assets/48736879-ff09-439d-8b1f-fb633a215333