improve sketch error messages in the editor console (wip)#4092
improve sketch error messages in the editor console (wip)#4092Nixxx19 wants to merge 16 commits intoprocessing:develop-codemirror-v6from
Conversation
This reverts commit 278b9c9.
|
Hi @Nixxx19, I have pulled your branch locally & tried to produce some errors by running some sketches. But check out this particular case when I tried to add Error.msg.bug.mp4As shown in the video, when error occurred, a new window opened up that shows the error. a. The window that opens up shows the same error in both slides. One of them can be removed. |
|
hey @aadityasingh9601, thanks for testing this out! so that full-screen red popup is actually webpack's dev-server overlay, not something the pr is rendering. it only runs in dev mode ( that said you helped me catch a real bug behind it. the html line offset wasn't being applied for inline scripts because of a small string mismatch ( just pushed a fix for it. also added a small range guard on the decoration call so it can't blow up on out-of-range lines. pull latest and it should be gone. the in-editor console message and gutter highlight still work normally. |
Hi @Nixxx19, thanks for the clarification about the red popup, now I get it. |



closes #4088.
opened the issue first because the editor console was surfacing much less info than the browser devtools, and i wanted to check the direction with maintainers before coding. this pr pulls together what was discussed there.
the short version of the problem: jshint was catching parse errors during preprocessing and then throwing them away, so syntax errors either silently disappeared or got replaced by a generic browser message with no file or line. runtime errors went through two different code paths with different output. the console message was a plain string, so the editor decoration had to re parse the string to recover the file and line it needed, and for blob urls it often failed and fell back to showing the raw blob path.
what the pr does:
=in a let/const/var, etc). one friendly block covers all errors on a run with a single mdn reference at the end, not one block per error.test plan, run locally against a clean p5 sketch:
note: the red overlay that shows in the preview iframe during dev is webpack dev server's runtime error panel from react-refresh-webpack-plugin, not something this pr controls. it does not exist in production builds.