fix(image): use FES for setFrame validation errors (#8610)#8613
Open
gourijain029-del wants to merge 1 commit intoprocessing:mainfrom
Open
fix(image): use FES for setFrame validation errors (#8610)#8613gourijain029-del wants to merge 1 commit intoprocessing:mainfrom
gourijain029-del wants to merge 1 commit intoprocessing:mainfrom
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Changes made
Replaced a raw
console.log()call inside setFrame() (in src/image/p5.Image.js) withp5._friendlyError(). This guarantees that if a user tries to set a GIF to an invalid frame index, the warning goes through the Friendly Error System and is suppressed properly ifp5.disableFriendlyErrorsis set to true.2. Which issue this PR fixes
Fixes #8610
3. Steps to test changes
loadImage().p5.disableFriendlyErrors = true;).gif.setFrame(9999);orgif.setFrame(-1);.