Skip to content

fix(data): replace raw console logs with FES in TypedDict (#8607)#8616

Open
gourijain029-del wants to merge 1 commit intoprocessing:mainfrom
gourijain029-del:fix-8607-typeddict-fes
Open

fix(data): replace raw console logs with FES in TypedDict (#8607)#8616
gourijain029-del wants to merge 1 commit intoprocessing:mainfrom
gourijain029-del:fix-8607-typeddict-fes

Conversation

@gourijain029-del
Copy link

1. Changes you have made

Replaced 6 instances of raw console.log() outputs with p5._friendlyError() across the Dictionary classes in src/data/p5.TypedDict.js. This ensures that validation error messages regarding nonexistent keys, invalid dictionary creation parameters, and unsupported key/value types are properly suppressible and formatted by the Friendly Error System.

(Note: As requested in the issue, the intentional console.log output inside the .print() method was left alone.)

2. Which issue this PR fixes

Fixes #8607

3. Steps to test changes

  • Set p5.disableFriendlyErrors = true;.
  • Construct a createStringDict() or createNumberDict() object.
  • Attempt to use .get(), .div(), or .add() on a key that you haven't added to the dictionary yet.
  • Verify nothing gets logged to your console.
  • Set p5.disableFriendlyErrors = false; (the default).
  • Verify the standard formatting of p5._friendlyError properly logs the warning.

…#8607)

Refactored validation checks across get, set, create, and NumberDict math methods to use p5._friendlyError() instead of console.log(). This ensures the errors are translatable via i18n and can be suppressed when p5.disableFriendlyErrors is true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[p5.js 2.0 Bug Report]: p5.TypedDict error messages bypass Friendly Error System (6 raw console.log calls)

1 participant