Improve FES error messages for color functions in p5.strands
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
Increasing access
Clear error messages help beginners debug shader code. The current FES messages for color functions in strands don't mention the specific function name or the invalid value, making it hard to know what went wrong.
The newly added color APIs in p5.strands expose a few cases where Friendly Error System (FES) messages could be more specific and beginner-friendly.
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)
Feature enhancement details
Three FES message improvements for strands color functions:
-
Missing parameter —
lerpColor(c, 0.5)(missing second color arg):
Current:"Function 'mix' has 3 variants which expect 3 arguments, but 2 were provided."
Suggested: mentionlerpColorby name, not the internalmixfunction -
Wrong parameter type —
red("blue")orlerpColor(c1, "blue", 0.5):
Current:"You've tried to construct a scalar or vector type with a non-numeric value: blue"
Suggested: also name which function was called and which argument was bad -
Invalid color string —
color('#fv0a'):
Current:"Error: Invalid color string"
Suggested: include the invalid string in the message so users know what to fix
Related PR: #8822
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the p5.strands color functions and their Friendly Error System message paths. Reproduce the listed lerpColor, red, and color examples, then update the messages so they identify the called function, invalid argument or value, and invalid color string; verify all three cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics, developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100