Skip to content

Fix warn handling for validation exceptions#293

Open
suebtwist wants to merge 1 commit into
gajus:masterfrom
suebtwist:fix-warn-validation-exceptions
Open

Fix warn handling for validation exceptions#293
suebtwist wants to merge 1 commit into
gajus:masterfrom
suebtwist:fix-warn-validation-exceptions

Conversation

@suebtwist
Copy link
Copy Markdown

Closes #113.

TypeContext.warn() now preserves warn-mode behavior when validation raises before a Validation object can be returned. Instead of propagating the exception, it emits the exception message via emitWarningMessage() and returns the original input, matching the non-throwing warning path.

Added a focused regression test using $Shape<string> because that path currently throws Can only $Shape<T> object types. during validation.

Verification:

  • npm test -- --grep TypeContext
  • npx eslint src\TypeContext.js src\TypeContext.test.js

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

2 participants