-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Labels
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.1.2
Web browser and version
Chrome
Operating system
macOS
Steps to reproduce this
Steps:
- Open the example sketch: https://editor.p5js.org/davepagurek/sketches/aVaqe0sNn
- Run the sketch (or create a new sketch with the code below)
- Open the browser console
- Observe that two errors appear instead of one
Problem:
When a variable is undefined (e.g., due to a typo or forgetting to define it), p5.js shows two errors:
- An error from FES trying to make an error
- The actual ReferenceError (e.g., "s is not defined")
The first FES error masks the real error message, making debugging harder.
Expected behavior:
Users should see a single, clear error message indicating the undefined variable.
Actual behavior:
Two errors appear — the FES error and the actual ReferenceError.
Additional context:
This is not p5.strands-specific; it also happens in regular p5.js.
Snippet:
warp = baseStrokeShader().modify(() => {
const frame = uniformFloat(() => frameCount)
getObjectInputs((inputs) => {
inputs.position.xy += 20 * noise(
inputs.position.x * s,
inputs.position.y * s,
frame * 0.01
)
})
return inputs
})
Note:
The variable s is intentionally undefined in this example.