Skip to content

fix: avoid throwing in warn mode when validation internals fail#299

Open
ncthuc2004 wants to merge 1 commit into
gajus:masterfrom
ncthuc2004:issuehunt-113-warn-no-throw
Open

fix: avoid throwing in warn mode when validation internals fail#299
ncthuc2004 wants to merge 1 commit into
gajus:masterfrom
ncthuc2004:issuehunt-113-warn-no-throw

Conversation

@ncthuc2004
Copy link
Copy Markdown

@ncthuc2004 ncthuc2004 commented May 16, 2026

Summary

  • prevent warn mode from throwing when validation internals raise invariant errors
  • catch thrown errors in TypeContext.warn(...) and emit them through emitWarningMessage(...)
  • add a regression test covering $Shape<T> misuse ($Shape<string>) in warn mode

Why

Issue #113 reports that warn: true still throws in some paths (for example $ShapeType invariants), which breaks the expected non-throw warning behavior.

Validation

  • ran targeted test:
    • npx mocha --require @babel/polyfill --require ./test-polyfill.js src/warn.test.js
  • result: passing (169 passing)

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


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.

1 participant