Skip to content

[p5.js 2.0+ Bug Report]: Some Vector friendly errors don't work correctly #8930

@sidwellr

Description

@sidwellr

Most appropriate sub-area of p5.js?

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

p5.js version

2.3.0

Web browser and version

Brave 1.90.122

Operating system

Linux Mint 22.1

Steps to reproduce this

Steps:

  1. Run the snippet below. It has an error; the first param should be a vector.
  2. The expected output is a friendly error message "The v1 parameter should be of type Array or p5.Vector"
  3. Instead, it gives an error "TypeError: this._friendlyError is not a function"

Snippet:

function setup() {
  print(p5.Vector.equals(1, createVector(1, 2)));
}

Discussion

Friendly errors for vectors seem to work fine for instance methods like setValue(), but not for static methods like p5.Vector.equals.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions