From 2a5de1d817ded94a46a15f3b4208e34185ee2558 Mon Sep 17 00:00:00 2001 From: "gourijain026@gmail.com" Date: Fri, 6 Mar 2026 05:24:12 +0530 Subject: [PATCH] fix(data): replace raw console logs with FES in TypedDict (#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. --- src/data/p5.TypedDict.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/data/p5.TypedDict.js b/src/data/p5.TypedDict.js index 449887157b..5dbbda30a4 100644 --- a/src/data/p5.TypedDict.js +++ b/src/data/p5.TypedDict.js @@ -164,7 +164,7 @@ p5.TypedDict = class TypedDict { if (this.data.hasOwnProperty(key)) { return this.data[key]; } else { - console.log(`${key} does not exist in this Dictionary`); + p5._friendlyError(`${key} does not exist in this Dictionary`); } } @@ -191,7 +191,7 @@ p5.TypedDict = class TypedDict { if (this._validate(value)) { this.data[key] = value; } else { - console.log('Those values dont work for this dictionary type.'); + p5._friendlyError('Those values dont work for this dictionary type.'); } } @@ -235,7 +235,7 @@ p5.TypedDict = class TypedDict { } else if (typeof key !== 'undefined') { this.set(key, value); } else { - console.log( + p5._friendlyError( 'In order to create a new Dictionary entry you must pass ' + 'an object or a key, value pair' ); @@ -459,7 +459,7 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { if (this.data.hasOwnProperty(key)) { this.data[key] += amount; } else { - console.log(`The key - ${key} does not exist in this dictionary.`); + p5._friendlyError(`The key - ${key} does not exist in this dictionary.`); } } @@ -509,7 +509,7 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { if (this.data.hasOwnProperty(key)) { this.data[key] *= amount; } else { - console.log(`The key - ${key} does not exist in this dictionary.`); + p5._friendlyError(`The key - ${key} does not exist in this dictionary.`); } } @@ -536,7 +536,7 @@ p5.NumberDict = class NumberDict extends p5.TypedDict { if (this.data.hasOwnProperty(key)) { this.data[key] /= amount; } else { - console.log(`The key - ${key} does not exist in this dictionary.`); + p5._friendlyError(`The key - ${key} does not exist in this dictionary.`); } }