Skip to content

Friendly Error points to executing line in the p5.js file, not the line causing the issue #8212

@Namrad

Description

@Namrad

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.

Image Image

Instances:

  1. When passing NaN into a createVector() method.
  2. 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);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions