Skip to content
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

p5.js Editor + Friendly Errors #5243

Closed
1 of 17 tasks
catarak opened this issue May 12, 2021 · 3 comments · Fixed by #5317
Closed
1 of 17 tasks

p5.js Editor + Friendly Errors #5243

catarak opened this issue May 12, 2021 · 3 comments · Fixed by #5317
Assignees

Comments

@catarak
Copy link
Member

catarak commented May 12, 2021

How would this new feature help increase access to p5.js?

This would improve the friendly errors on the web editor!

Most appropriate sub-area of p5.js?

  • Accessibility (Web Accessibility)
  • Build tools and processes
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Friendly error system
  • Image
  • IO (Input/Output)
  • Localization
  • Math
  • Unit Testing
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible)

Feature enhancement details:

TL;DR: I would like to get access to the private function report() to monkey patch it in order to make friendly errors look better in the web editor.

Why I would like to do this: I've been updating the way the p5.js Editor renders sketches for security reasons (processing/p5.js-web-editor#166). Recently, this issue came in (processing/p5.js-web-editor#1853) about the web editor not being friendly with using the debugger. I did some thinking about how to fix this and came up with a solution! But. It caused me to look at how friendly errors look in the web editor.

Current rendering engine, friendly errors

Screen Shot 2021-05-12 at 4 14 14 PM

New rendering engine, friendly errors

Screen Shot 2021-05-12 at 4 14 46 PM

As you can see, the friendly errors don't give useful information about the error location due to the magic that the p5.js editor does in order to render everything client-side. What are these seemingly meaningless URLs? They are Object URLs.

But! If I were able to monkey patch the report() function, I would be able to substitute the actual file names for the ObjectURLs in the messages.

Also, my reasoning for requesting for monkey patching versus a public API for updating the friendly errors is that this issue is editor specific—I'm not sure this issue would come up in any other places.

@nully0x
Copy link
Contributor

nully0x commented May 12, 2021

while working with the web-editor I noticed the inconsistencies in error reporting and references this you have pointed out.

@outofambit
Copy link
Contributor

@catarak i'm very willing to make report monkeypatchable for the editor! i can take this one

@outofambit outofambit self-assigned this May 29, 2021
@catarak
Copy link
Member Author

catarak commented Jun 1, 2021

thank you @outofambit!

I also wonder if it would ever make sense to create an API for the p5.js FES. Some reasons that come to my head:

  • Allowing p5.js addons to create friendly errors
  • Allowing p5.js addons to overwrite friendly errors, targeting different user demographics, perhaps for internationalization or other reasons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants