Skip to content

Warn via FES when bezierOrder() receives a value other than 2 or 3 - #9136

Merged
perminder-17 merged 3 commits into
processing:mainfrom
harshiltewari2004:bezier-order-fes-warning
Sep 16, 2026
Merged

perminder-17 merged 3 commits into
processing:mainfrom
harshiltewari2004:bezier-order-fes-warning

Conversation

@harshiltewari2004

Copy link
Copy Markdown
Contributor

Resolves #9079

Changes

bezierOrder() is documented as accepting 2 or 3 but validated nothing, so
out-of-range values reached the renderers and failed differently in each:
2D drew nothing, WebGL silently reinterpreted the shape as a quadratic, and
bezierOrder(1) threw a TypeError from inside p5.

fn.bezierOrder now emits a non-blocking FES warning when the order isn't
2 or 3. Renderer behaviour is unchanged — this only adds a message.

Per @davepagurek's preference on the issue, the check reads
p5.disableFriendlyErrors first, so a sketch with FES turned off does no
further work. order !== undefined is checked next so the getter form
(bezierOrder() with no argument) doesn't warn.

Non-numeric and non-integer values ('3', 2.5, null) also warn, since
they fail the same comparison.

The order-1 TypeError still occurs after the warning; the warning names
bezierOrder first, so the user sees the cause before the crash.

PR Checklist

  • npm run lint passes
  • [Inline reference] is included / updated
  • [Unit tests] are included / updated

@p5-bot

p5-bot Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

@perminder-17 perminder-17 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@perminder-17
perminder-17 merged commit 8ce2594 into processing:main Sep 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[p5.js 2.0+ Bug Report]: bezierOrder() accepts values outside its documented range, and 2D and WebGL then fail differently and silently

2 participants