Skip to content

light.js + material.js: replace console.warn with Friendly Error System (FES) #8595

@MASTERsj01

Description

@MASTERsj01

Increasing access

Using p5._friendlyError() ensures lighting and material warnings are displayed consistently and can be suppressed via p5.disableFriendlyErrors.

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)

Feature enhancement details

light.js uses 6 console.warn and material.js uses 3 console.warn instead of p5._friendlyError():

light.js (6 calls):

  • Lines 1236, 1243, 1250: lightFalloff() negative value warnings
  • Line 1260: lightFalloff() all-zero arguments warning
  • Line 1639: spotLight() wrong argument count
  • Line 1671: spotLight() concentration < 1

material.js (3 calls):

  • Line 2074: textureMode() invalid mode
  • Line 3281: blendMode(DARKEST) unsupported in WebGL
  • Line 3294: blendMode(LIGHTEST) unsupported in WebGL

I have a PR ready.

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