Friendly Error points to executing line in the p5.js file, not the line causing the issue
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- p5.strands
- WebGL
- DevOps, Build process, Unit testing
- Internationalization (i18n)
- Friendly Errors
- Other (specify if possible)
p5.js version
2.0.5.
Web browser and version
Vivaldi 7.6.3797.63 (Stable channel) (arm64)
Operating system
Apple M4 Max, Sequoia 15.6
Steps to reproduce this
No real 'steps' involved. Just ran into this while transferring to p5.js 2.0.5:
While using VS Code: When reading the console the Friendly Error message points to the line in the p5.js main-file that executes the Friendly Error message itself, rather than what caused the Friendly Error message in my own .js file.
Because of this I had to manually go over all instances of createVector() and float(), to see where the error came from.
The friendly error messages are really helpful as opposed to the 'unfriendly ones', especially for autodidact coders like me. Maybe therefor this is not necessarily a bug, but more a feature request. I hope this is helpful either way. Sorry if this is an incorrect bug report.
Instances:
- When passing
NaNinto acreateVector()method. - When using
float()method incorrectly.
Snippet:
function setup() {
let vectorA = createVector(10, NaN);
let vectorB = createVector(vectorA.x + vectorA.y, vectorA.y);
}
function setup() {
let divisor = 2;
let time = float(frameCount / divisor);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided createVector() and float() snippets while reading the VS Code console. Trace the Friendly Errors entry points and determine how the reported location is selected. Done means the message links to the user's .js line that caused the error rather than the p5.js implementation line, with coverage for both reported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100