Skip to content

Fix static p5 vector method#8998

Open
Ayush4958 wants to merge 3 commits into
processing:mainfrom
Ayush4958:fix-static-p5-vector-method
Open

Fix static p5 vector method#8998
Ayush4958 wants to merge 3 commits into
processing:mainfrom
Ayush4958:fix-static-p5-vector-method

Conversation

@Ayush4958

Copy link
Copy Markdown

Resolves #8930

Changes:

  • In src/math/p5.Vector.js :- Properly bound _friendlyError & friendlyErrorsDisabled to the static Vector. Added early false after the friendly error is triggered. This prevents a secondary crash.

  • Added a new unit test suite to ensure the static FES validation works.

Screenshots of the change:
Screenshot 2026-07-21 071243

PR Checklist

  • npm run lint passes
  • [Unit tests] are included / updated

@welcome

welcome Bot commented Jul 21, 2026

Copy link
Copy Markdown

🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors!
🤔 Please ensure that your PR links to an issue, which has been approved for work by a maintainer; otherwise, there might already be someone working on it, or still ongoing discussion about implementation. You are welcome to join the discussion in an Issue if you're not sure!
🌸 Once your PR is merged, be sure to add yourself to the list of contributors on the readme page !

Thank You!

@Ayush4958

Ayush4958 commented Jul 21, 2026

Copy link
Copy Markdown
Author

@ksen0
PR is ready for review

thnks ...

@p5-bot

p5-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: e09e6f7

Previous deployments

This is an automated message.

Comment thread src/math/p5.Vector.js
Comment on lines +3664 to +3667
Vector._friendlyError = p5._friendlyError;
Vector.friendlyErrorsDisabled = function() {
return p5.disableFriendlyErrors;
};

@perminder-17 perminder-17 Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are defining the fes in the vector class and here p5._firendlyError is a global static.

What if we don't do this and everywhere in this file wherever this._friendlyError is called we replace it with p5._friendlyError it should work the same and could look a little cleaner?

It's similar to how setHeading() is in this file (line no. 2028)?

what you think?

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

Successfully merging this pull request may close these issues.

[p5.js 2.0+ Bug Report]: Some Vector friendly errors don't work correctly

2 participants