Skip to content

[p5.js 2.0 Bug Report]: noiseDetail(1) triggers Friendly Error even though second parameter is optional #8402

@shuklaaryan367-byte

Description

@shuklaaryan367-byte

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.1.2

Web browser and version

Google Chrome Version 143.0.7499.170

Operating system

Windows 11

Steps to reproduce this

Steps:

  1. Open the p5.js Web Editor

  2. Ensure Friendly Errors are enabled (default)

  3. Run the sketch below

  4. Observe a Friendly Error warning in the console

Snippet:

function setup() {
  noCanvas();
  noiseDetail(1);
  console.log(noise(0.5));
}

Expected behaviour:

According to the documentation, the second argument to noiseDetail() (falloff) is optional because a default value (0.5) is defined. Calling noiseDetail(1) should therefore be valid and should not trigger a Friendly Error warning.

Actual behaviour:

p5.js displays a Friendly Error warning:
“Expected number at the second parameter in noiseDetail()”
even though the call is valid and the sketch runs correctly.

Additional confirmation:

When p5.disableFriendlyErrors = true is set, the warning disappears, confirming this is an FES validation bug rather than a problem with noiseDetail() itself.

I’m happy to help implement a fix if this is approved.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions