From dec9c71002f6141988a93bcc3f90f983f934b5ac Mon Sep 17 00:00:00 2001 From: "gourijain026@gmail.com" Date: Fri, 6 Mar 2026 05:01:32 +0530 Subject: [PATCH] fix(image): use FES for setFrame validation errors (#8610) Replaced raw console.log with p5._friendlyError when alerting the user about an out-of-range frame index in setFrame. This ensures the warning is properly formatted and respects the p5.disableFriendlyErrors setting. --- src/image/p5.Image.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/image/p5.Image.js b/src/image/p5.Image.js index 1db788cd9c..ee85e13c94 100644 --- a/src/image/p5.Image.js +++ b/src/image/p5.Image.js @@ -312,7 +312,7 @@ p5.Image = class { */ pixelDensity(density) { if (typeof density !== 'undefined') { - // Setter: set the density and handle resize + // Setter: set the density and handle resize if (density <= 0) { const errorObj = { type: 'INVALID_VALUE', @@ -334,7 +334,7 @@ p5.Image = class { return this; // Return the image instance for chaining if needed } else { - // Getter: return the default density + // Getter: return the default density return this._pixelDensity; } } @@ -1808,7 +1808,7 @@ p5.Image = class { props.displayIndex = index; this.drawingContext.putImageData(props.frames[index].image, 0, 0); } else { - console.log( + p5._friendlyError( 'Cannot set GIF to a frame number that is higher than total number of frames or below zero.' ); }