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?
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: mention lerpColor by name, not the internal mix function
-
Wrong parameter type — red("blue") or lerpColor(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
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?
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: mention
lerpColorby name, not the internalmixfunctionWrong 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