processing / processing/p5.js

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

Open
#8,212 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Friendly Errors
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.

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);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.