Skip to content

FES error masks actual undefined variable ReferenceError #8381

@Aayushdev18

Description

@Aayushdev18

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:

  1. Open the example sketch: https://editor.p5js.org/davepagurek/sketches/aVaqe0sNn
  2. Run the sketch (or create a new sketch with the code below)
  3. Open the browser console
  4. 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:

  1. An error from FES trying to make an error
  2. 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions