Skip to content

Disable Friendly Errors sometimes doesn't work #3178

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

Closed
3 of 17 tasks
catarak opened this issue Aug 29, 2018 · 3 comments
Closed
3 of 17 tasks

Disable Friendly Errors sometimes doesn't work #3178

catarak opened this issue Aug 29, 2018 · 3 comments

Comments

@catarak
Copy link
Member

catarak commented Aug 29, 2018

Nature of issue?

  • Found a bug
  • Existing feature enhancement
  • New feature request

Most appropriate sub-area of p5.js?

  • Color
  • Core/Environment/Rendering
  • Data
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible): Friendly Errors

Which platform were you using when you encountered this?

  • Mobile/Tablet (touch devices)
  • Desktop/Laptop
  • Others (specify if possible)

Details about the bug:

  • p5.js version: 0.7.1
  • Web browser and version:
  • Operating System:
  • Steps to reproduce this:

In trying to work on processing/p5.js-web-editor#417, I noticed that sometimes using the flag p5.disableFriendlyErrors works, and other times it doesn't work. For example,

p5.disableFriendlyErrors = true;

function setup() {
  ellipse(3, 3);
}

won't display the friendly error, but

p5.disableFriendlyErrors = true;

var myFont;
function setup() {
  myFont = loadFont('doesntExist.ttf');
}

will still show the friendly error. Maybe it has to do with loadFont() being asynchronous? I notice the same behavior with loadImage() as well.

@lmccart
Copy link
Member

lmccart commented Aug 30, 2018

I believe the disabling refers to the removal of the type checking for arguments, which is what slows down the code. In the case of loading images or fonts, an error is returned by the browser if the file isn't found, and the FES just adds some info to make it a little clearer. We could of course prevent this, but it's not causing any performance slowdown in these cases. Or maybe we need to change the documentation and name of p5.disableFriendlyErrors to something like p5.disableParameterChecking? I don't know though, because this naming might be more confusing for beginners.. thoughts?

@catarak
Copy link
Member Author

catarak commented Aug 30, 2018

Got it. I agree that the naming change would be confusing to beginners. Maybe just the documentation could be updated? Is it documented outside of the wiki (https://github.com/processing/p5.js/wiki/Optimizing-p5.js-Code-for-Performance#disable-the-friendly-error-system)?

@lmccart lmccart closed this as completed in 347fe7f Sep 1, 2018
@lmccart
Copy link
Member

lmccart commented Sep 1, 2018

Thanks, I've updated the documentation in the wiki and in the developer docs.

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

No branches or pull requests

2 participants