Commit 550010c
Improve friendly error message (#1487)
❗ This branch was created by rebasing
#1485 to
#1483.
### How to enable friendly errors
- editor-standalone (for editor): add `friendly_errors_enabled: true` to
`options` in src/components/Editor/Project/Project.jsx
### Decisions made upon adding [pfem v.
0.7.0](https://github.com/RaspberryPiFoundation/python-friendly-error-messages/releases)
- For now, we are showing `title` and `summary` of friendly errors
(potentially `why` bit might also be added later on)
- `ErrorMessage` now optionally includes `FriendlyErrorMessage`
- The new attribute added and set to `true` in in src/web-component.html
(for http://localhost:3011/web-component.html)
- Moved `ErrorMessage` to the bottom of input panel above Run button
- In mobile screens (`MobileProject`), 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)
- For Skulpt runner, [the logic of showing error when not in output only
mode is now
removed](https://github.com/RaspberryPiFoundation/editor-ui/pull/1487/changes#diff-b905586781d8ed679facb77f80b18decb431bb0c1c9576b34e43745c3348a6ab),
keeping the same behaviour of no error in output only mode.
- For Pyodide runner, [a logic for showing error message when in output
only
mode](https://github.com/RaspberryPiFoundation/editor-ui/pull/1487/changes#diff-9950a7b6007ef96b6e4ca4e8e0ad4461249437b7121f74511804b3b0139ada2a)
is now added
- As in `WebcomponentProject.jsx`, EditorInput is not rendered at all in
output only mode, resulting in `ErrorMessage` displayed only by Output
panel of Pyodide
- When there are multiple Python files:
- An error from `main.py` shows first.
- When there are errors only in files other than `main.py`, they will
show (one at a time).
- Whatever error is shown will stay even when you select other tabs
within the input panel.
### WIP and future pfem
- More discussion needed in terms of the possibility of adding `why` of
friendly error, copy and UI
### Screen 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
---------
Co-authored-by: Max Elkins <max.elkins@raspberrypi.org>
Co-authored-by: Greg Annandale <greg@raspberrypi.org>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent 78b3328 commit 550010c
28 files changed
Lines changed: 635 additions & 199 deletions
File tree
- cypress
- e2e
- fixtures
- helpers
- src
- assets
- icons
- stylesheets
- components
- Editor
- EditorInput
- ErrorMessage
- FriendlyErrorMessage
- Runners/PythonRunner
- PyodideRunner
- SkulptRunner
- Mobile/MobileProject
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
| 537 | + | |
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
| |||
Loading
Loading
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
0 commit comments