Repository navigation
feat(core): Support Zod 4 errors in zodErrorsIntegration - #25756
Draft
sentry-junior[bot] wants to merge 1 commit into
Draft
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
Handle `$ZodError` thrown by `zod/mini` and flatten Zod 4's nested union `errors` the same way `unionErrors` is flattened for Zod 3. Co-Authored-By: Andrei Borza <andrei.borza@sentry.io>
Contributor
size-limit report 📦Compared: bf62578 (PR test merge using develop at 0b5f66e) Against: 0b5f66e (develop) · base run #63651 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 6 not successful, 59 successful. See the run.
Successful checks
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zodErrorsIntegrationwas written against Zod 3 and misses two Zod 4 shapes.zod/minithrows an error named$ZodError, so those errors skipped the integration entirely. Zod 4 also nests union failures undererrorsinstead ofunionErrors, so they ended up inextraas deeply nested objects (and got truncated by normalization) instead of a flattened string.This change accepts
$ZodErrorand stringifieserrorsthe same way we already stringifyunionErrors. Theerrorskey is only added when an issue actually has it, so Zod 3 output stays byte-for-byte the same.The new tests import
zod/v4andzod/v4/mini. Those subpaths exist in both the current 3.25 dev dependency and in 4.x, so the tests don't depend on #25655 landing first.via Andrei Borza.
--
View Junior Session [Sentry]