-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
FES: Global Error Catching #4670
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
Conversation
Show friendly messages for a few reference, syntax and type errors
c8c88d8
to
e81e664
Compare
3d08f6e
to
71210f5
Compare
d48b2a9
to
bd31d85
Compare
So I think this is now ready for review. There are a few problems when running this on the web editor.
Colours and styling for FES messages does seem to work on the web editor as of now. However, I decided not to enable it yet as it would be nice if someone else could explain why it was disabled in the first place. Styling can be enabled later just by the flipping this toggle. Since there are a lot of sketches needed to test all these changes, I am posting links to the editor instead of pasting all the codes here. While reviewing please check them on the editor as well as locally.
|
Great! This is really exciting. This is a big one so I will review over the next few days. If I remember correctly from your schedule, your next goal isn't dependent on this so feel free to jump into that while I find time to review this. If I am incorrect about scheduling, let me know, and I will expedite the review. |
Yes I can work on the next thing while this gets reviewed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Few questions and suggestions inline.
9a31ee0
to
b522269
Compare
@stalgiag I have pushed the changes. I also removed a redundant explanatory comment from a test case as the test above it also had the same comment. |
So I did a little digging on this. The reason the web editor cannot display errors in the editor-console with p5.js 1.0.0 is because of the fact that in 1.0.0, |
Amazing addition @akshay-99 thanks for the hard work! Will you open an issue about the promise-based errors not posting to the editor console? You can open it on this repo and if we decide the change needs to happen on the editor side we can transfer it. Very excited to have these friendly messages for global errors :-D |
Resolves #4662
Changes:
Pending
There may be unintentional errors that happen inside the p5js library. Often these are due to wrong arguments but may sometimes be due to other reasons. There are also a bunch of intentional errors that the library can throw. These are often confusing as they point to a line inside the library and the stacktrace is filled with internal calls. These can be simplified by focusing on the lines in the sketch that led to it. As seen above, the error from the browser can be confusing and the FES can quickly inform about the relevant details.
It may be good to consider using some styling ( colours, font, etc ) to pull the focus away from the raw error of the browser and towards the simpler FES message.

From what I could gather, styling of log messages used to be a part of the FES until it was removed three years ago in #2141, to integrate with the web editor, which was new back then. I assume that the console on editor did not support styling of messages back then. But I tried it now, and it seems to work. https://editor.p5js.org/akshay.padte/sketches/8VFX4Fq2v
It would great if someone could give some insight as to exactly why styling was removed in the FES and the current status with the web editor.
PR Checklist
npm run lint
passes