-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[WIP] display the script error caused by external library #579
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
partly relates to #468 :)
Still need to know more about how to display lineNumber when the error caused by external library. |
this is interesting and i'm not sure how to handle it. the issue is that the user is using the library improperly. i think the ideal case is that we would get the full stack trace of the error, figure out the line that is in one of the files in sketch itself, and put the error on that line, and show the full stack trace in the console. can you get the whole stack trace? there's a script called |
The first one seems to be working properly now:)
this one doesn't show whole stack trace, only reports |
cool, i like where this is going! i wonder if it would make sense to send the whole stack back to the in-window console? is it too confusing for a coding newbie? vs. is there potentially a happy medium? as someone with coding experience i found the error confusing because i was like, "toString isn't being called on this line," and i think it's important to say that the error is being thrown in another file, but is a result of the user not using the library correctly, and therefore there still is in error. thoughts @lmccart & @shiffman? i also just changed the p5 version to the non-minified version to see if the friendly errors system would catch it, and it doesn't. |
I think the ideal outcome would be for the error to read something like:
So maybe this is a matter of adding this particular scenario to the friendly errors system? If rewriting the error is not an option I think I would stick with the single error over the full stack trace for the web editor? We could reconsider this based on any future work on the console itself #7 -- for example, maybe the full stack trace could "unfold"? But my instinct says that the full stack trace is more scary than helpful, and it would be available in the chrome developer tools should someone want to look. |
makes sense to me! |
For now let's go with "Uncaught TypeError: Cannot read property 'toString' of undefined (sketch: Line 5)". I can add an issue regarding a friendly error for this separately in the p5.js repo. |
That will be fine 😄 |
cool, then this PR is good to be merged. |
Before your pull request is reviewed and merged, make sure you
npm run lint
Fixes #123
Thank you!