Skip to content

[p5.js 2.0 Bug Report]: Raw console.log() calls in WebGL modules should use Friendly Error System #8651

@MASTERsj01

Description

@MASTERsj01

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

dev-2.0

Web browser and version

Any

Operating system

Any

Steps to reproduce this

Several WebGL modules in the dev-2.0 branch use raw console.log() for debug/error messages instead of the Friendly Error System. These messages are not suppressed by p5.disableFriendlyErrors = true and cannot be translated via i18n.
This was discussed with @davepagurek on Discord, who confirmed these should be converted to FES (except p5.Shader.inspectHooks(), which is an intentional user-facing debug tool).
Affected locations (all confirmed on dev-2.0 branch):
1. src/webgl/ShapeBuilder.js — 3 raw console.log() calls (tesselation callbacks)

  • begincallback() line 441: logs unexpected primitive type
  • errorcallback() line 446: logs "error callback"
  • errorcallback() line 447: logs error number

Note: Per @davepagurek — these are debug callbacks we don't expect to be called, but if triggered, the output is very useful. These should become FES errors that also encourage the user to report a bug with the error info.
2. src/webgl/p5.RendererGL.js — 5 raw console.log() calls

  • Line 253: debug console.log
  • Line 295: debug console.log
  • Line 308: debug console.log
  • Line 354: debug console.log
  • Line 541: debug console.log
    3. src/webgl/p5.Camera.js — 2 raw console.log() calls
  • Line 209: debug console.log
  • Line 216: debug console.log
    4. src/webgl/text.js — 2 raw console.log() calls
  • Line 677: debug console.log
  • Line 687: debug console.log
    5. src/webgl/utils.js — 2 raw console.log() calls
  • Line 279: debug console.log
  • Line 316: debug console.log
    6. src/webgl/3d_primitives.js — 7 raw console.log() calls
  • Line 1701: debug console.log
  • Line 2246: debug console.log
  • Line 2330: debug console.log
  • Line 2394: debug console.log
  • Line 2435: debug console.log
  • Line 2476: debug console.log
  • Line 2544: debug console.log
    Excluded (intentionally left as-is):
  • src/webgl/p5.Shader.js — inspectHooks() (lines 146-166) is a user-facing debug utility and should remain using console.log as confirmed by @davepagurek.

Expected behavior

All validation/warning/error messages should use p5._friendlyError() so they:

  1. Respect p5.disableFriendlyErrors
  2. Can be translated via the i18n system
    For ShapeBuilder.js specifically, the FES messages should encourage users to report a bug with the error details.

Steps to reproduce (example):

  1. Set p5.disableFriendlyErrors = true
  2. Trigger any WebGL debug log (e.g., a tesselation error in ShapeBuilder)
  3. Observe: warning still appears in console despite FES being disabled
    I have confirmed all locations exist on the dev-2.0 branch and would be happy to open a PR targeting dev-2.0.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions