Skip to content

Warn instead of throwing validation-time errors#304

Open
cedar323 wants to merge 1 commit into
gajus:masterfrom
cedar323:fix-warn-mode-validation-errors-113
Open

Warn instead of throwing validation-time errors#304
cedar323 wants to merge 1 commit into
gajus:masterfrom
cedar323:fix-warn-mode-validation-errors-113

Conversation

@cedar323
Copy link
Copy Markdown

@cedar323 cedar323 commented Jun 2, 2026

Fixes #113.

What changed

  • TypeContext.warn() now converts validation-time exceptions into warning messages instead of throwing.
  • Added a regression test for a $Shape<T> invariant raised during validation setup.

Why

warn: true should warn and return the original input instead of throwing. Some validation paths can fail before a Validation object is returned, so the warning path needs to handle those exceptions too.

Validation

  • node ..\..\node_modules\mocha\bin\mocha --require @babel/polyfill --require .\test-polyfill.js src\typed.test.js
  • Result: 169 passing

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.

Errors are sometimes thrown with "warn" option

1 participant