processing / processing/p5.js

Improve FES error messages for color functions in p5.strands

Open
#8,914 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Color Enhancement
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:

  1. 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

  2. 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

  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.