Add comment to ZodError.message getter noting that it returns JSON #3937
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.
Per #2883, there seems to be quite a bit of confusion around the meaning of the
ZodError.message
field (which returns JSON instead of a simple human-readable error message, as one might expect given the name).Unsure how intentional the current behavior is(edit: sounds like it is intentional, and this makes sense) or if the field is meant to be used at all (I don't see it directly in docs (https://zod.dev/?id=error-handling, https://zod.dev/ERROR_HANDLING), but at the very least an explanatory comment would help to avoid some confusion and wouldn't be a breaking change.