-
Notifications
You must be signed in to change notification settings - Fork 12
Improve friendly error message #1487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cocomarine
wants to merge
65
commits into
main
Choose a base branch
from
1448-and-ui-branches-combined
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
188bead
install pfem
cocomarine e8ed800
update webpack config to disable ESM strict resolution for pfem
cocomarine cfa91e6
add pfem to skulpt runner WIP pyodide runner
cocomarine e594994
Merge branch 'main' into 1448-add-improved-error-messaging
cocomarine 088617a
fix pyodide error
cocomarine ffb0c84
Merge branch 'main' into 1448-add-improved-error-messaging
cocomarine 3ae80e6
add friendly error enabled attribute
cocomarine cb9f905
fix errors due to ESM to CJS transform
cocomarine 4bf16ec
remove unnecessary mock
cocomarine 9af9cfe
add friendlyError to redux and show in ErrorMessage
cocomarine 7c05ba7
minor fixes
cocomarine c1b803f
update editorslice and errormessage tests
cocomarine 0958129
update pyodide and skulpt runner tests
cocomarine 6ff35ec
plain text friendly error for now
cocomarine 0ac2991
add dompurify
cocomarine 64c2c4c
dispatch friendly error html and use css to restrict to title and sum…
cocomarine 4fda69e
update runner tests
cocomarine 3dc2a2e
update editorslice test
cocomarine 5be1299
stub out friendlyerror html in tests
cocomarine 113797f
refactor: remove defaulting to editor styles
maxelkins 9a5b56c
refactor: move error message to `EditorInput`
maxelkins 4971474
feat: add initial FriendlyErrorMessage UI component into ErrorMessage
maxelkins 3dbfc83
revert: move error back to output panel
maxelkins 626bd41
use FriendlyErrorMessage component and update styling
cocomarine 9a8b187
add font size to original error message and minor fixes
cocomarine 8bd51f8
remove fem stub, add friendly test, revert error message test
cocomarine f309c11
update cypress test helper to new class
cocomarine aa137a3
update cypress test
cocomarine c744d3e
intercept the copydeck request before running code
cocomarine a194986
fix flaky test
cocomarine d4684b4
Merge branch 'main' into 1448-and-ui-branches-combined
cocomarine 4ad3ef1
Merge branch 'main' into 1448-and-ui-branches-combined
cocomarine da8c411
resolve conflicts
cocomarine 7a807ff
try using fixture of copydeck for test
cocomarine b696959
Merge branch 'main' into 1448-and-ui-branches-combined
cocomarine 9bc9022
update pyodide cy
cocomarine adce42e
Merge branch '1448-and-ui-branches-combined' of github.com:RaspberryP…
cocomarine 454a80d
uncomment test
cocomarine 3ff953e
WIP move pyodide error to input panel
cocomarine 7113cac
move error to input panel and show input panel in mobile when error e…
cocomarine ccfa903
update tests
cocomarine 54e3cea
add styling to pfem var and tidy
cocomarine 1df6e2e
add styling to pfem and fix pyodide friendly error
cocomarine f2fdaad
use logical css
cocomarine 50c402d
update pfem styling
cocomarine 8fe26da
Merge branch 'main' into 1448-and-ui-branches-combined
cocomarine bf0991a
update styling
cocomarine 625e12e
update error trace object for pyodide pfem
cocomarine cb14058
improve codeLine and add caret line test
cocomarine 1d875c3
linting
cocomarine 15a8862
tidy
cocomarine 28fece4
show error to output only mode pyodide
cocomarine 8716bdd
update pfem to 0.3.0
cocomarine 3d832eb
feat: update PFEM lib to 0.5.0, pass `file` to friendlyExplain() expl…
grega 91d8fa3
update test and revert back to using trace object
cocomarine 15b02dd
Merge branch '1448-and-ui-branches-combined' of github.com:RaspberryP…
cocomarine 13e3a78
add rawTrace back in and update test
cocomarine 185c1f4
feat: bump PFEM to version 6, gaining a11y improvements
grega 1242226
add language guard and update fixutre
cocomarine 15f8aea
Merge branch '1448-and-ui-branches-combined' of github.com:RaspberryP…
cocomarine 763849e
add try catch for pfem and update test
cocomarine 93bd4fc
bump PFEM to version 7 for copy and variant update
cocomarine 9f7c403
Merge branch 'main' into 1448-and-ui-branches-combined
cocomarine b6a3cc9
update svg path for file icon
cocomarine 0b23980
Merge branch 'main' into 1448-and-ui-branches-combined
cocomarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| { | ||
| "meta": { | ||
| "language": "en", | ||
| "version": 1 | ||
| }, | ||
|
|
||
| "errors": { | ||
| "NameError": { | ||
| "variants": [ | ||
| { | ||
| "if": { | ||
| "not_message": ["is not defined"] | ||
| }, | ||
| "title": "This variable doesn't exist yet", | ||
| "summary": "Your code uses the variable {{name}}, but it hasn't been created yet. Check {{loc}}. If you meant to print the text {{name}}, put it in double quotes.", | ||
| "why": "Without speech marks Python treats {{name}} as a variable, and this variable does not exist yet.", | ||
| "steps": [ | ||
| "If it is meant to be text, put speech marks around {{name}}.", | ||
| "If it is meant to be a variable, make it first (for example: {{name}} = 0).", | ||
| "Check spelling and capital letters." | ||
| ], | ||
| "_placeholders": { | ||
| "name": "The undefined variable name, e.g. kittens", | ||
| "loc": "Where it was used, e.g. line 2 in main.py" | ||
| } | ||
| }, | ||
| { | ||
| "if": { | ||
| "match_message": ["is not defined"] | ||
| }, | ||
| "title": "This variable doesn't exist here", | ||
| "summary": "{{name}} might be created somewhere else, but you're using it at {{loc}}. If you meant the text {{name}}, put it in double quotes.", | ||
| "why": "A variable created in another place might not be available here.", | ||
| "steps": [ | ||
| "Move the line that makes it to above where you use it.", | ||
| "Or set it here just before you use it." | ||
| ], | ||
| "_placeholders": { | ||
| "name": "The variable name used out of scope, e.g. total", | ||
| "loc": "Where it was referenced, e.g. line 8 in main.py" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } |
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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,34 @@ | ||
| @use "./rpf_design_system/font-size" as *; | ||
| @use "./rpf_design_system/spacing" as *; | ||
| @use "@raspberrypifoundation/design-system-core/scss/mixins/typography" as | ||
| typography; | ||
|
|
||
| .error-message { | ||
| color: #7e0305; | ||
| background-color: #fde2e1; | ||
| padding: $space-0-75 $space-1-25; | ||
| color: var(--rpf-red-900); | ||
| background-color: var(--rpf-red-100); | ||
| border-block-start: 1px solid var(--editor-color-outline); | ||
| padding: var(--space-1); | ||
| overflow-y: auto; | ||
| scrollbar-width: thin; | ||
| max-block-size: 30%; | ||
|
|
||
| &__content { | ||
| &__error { | ||
| padding: 0; | ||
| margin: 0; | ||
| white-space: pre-wrap; | ||
| overflow-wrap: break-word; | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| &--medium { | ||
| @include font-size-1-5(regular); | ||
| } | ||
|
|
||
| &--large { | ||
| @include font-size-2(regular); | ||
| } | ||
| &__python { | ||
| display: flex; | ||
| gap: var(--space-1); | ||
| @include typography.style-1; | ||
|
|
||
| // Only displaying title and summary of friendlyError | ||
| &__friendly { | ||
| .pfem__why, | ||
| .pfem__steps, | ||
| .pfem__patch, | ||
| .pfem__details { | ||
| display: none; | ||
| &--medium { | ||
| @include typography.style-1; | ||
| } | ||
|
|
||
| &--large { | ||
| @include typography.style-2; | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| .friendly-error-message { | ||
| background-color: var(--rpf-white); | ||
| padding: var(--space-1) var(--space-1-5); | ||
| color: var(--rpf-text-primary); | ||
| border-radius: var(--space-1); | ||
| margin-block-start: var(--space-1); | ||
|
|
||
| &__content { | ||
| line-height: 1.75rem; | ||
|
|
||
| .pfem__title { | ||
| font-weight: 600; | ||
| display: inline; | ||
| } | ||
|
|
||
| .pfem__summary { | ||
| display: inline; | ||
|
|
||
| &::before { | ||
| content: " - "; | ||
| } | ||
| } | ||
|
|
||
| .pfem__var, .pfem__code, .pfem__file, .pfem__line { | ||
| font-family: var(--wc-font-family-monospace); | ||
| border-radius: 0.25rem; | ||
| padding: 0.2rem var(--space-0-5); | ||
| } | ||
|
|
||
| .pfem__var { | ||
| background-color: var(--rpf-green-100); | ||
| } | ||
|
|
||
| .pfem__code { | ||
| background-color: var(--rpf-grey-100); | ||
| } | ||
|
|
||
| .pfem__file { | ||
| white-space: nowrap; | ||
| background-color: var(--rpf-yellow-100); | ||
|
|
||
| &::before { | ||
| content: ""; | ||
| display: inline-block; | ||
| inline-size: 1em; | ||
| block-size: 1em; | ||
| background: url("../error_file.svg") no-repeat center; | ||
| background-size: contain; | ||
| margin-inline-end: 0.12rem; | ||
| vertical-align: middle; | ||
| } | ||
| } | ||
|
|
||
| .pfem__line { | ||
| background-color: var(--rpf-blue-100); | ||
| } | ||
| } | ||
| } | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.