Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(docs): next-forms fix unhandled run time error #56600

Merged
merged 3 commits into from
Nov 16, 2023

Conversation

MrNiceRicee
Copy link
Contributor

What?

The zod.parse() in the example will cause an unexpected run time error. Proposed solve is to use zod.safeParse() so there won't be an unhandled error exception. Question: use try/catch or safeParse?

Why?

Example for next-forms will have an unexpected run time error with the current implementation. Changed it so it will be handled through safeParse. So when users are following this portion of the docs they will not encounter an unexpected run time error if they enter an empty string.

How?

parse() throws an error, and because the server action does not have a top level try/catch to handle the exception, it eventually bubbles up to an Unhandled Runtime Error

@MrNiceRicee MrNiceRicee requested review from a team as code owners October 9, 2023 06:53
@MrNiceRicee MrNiceRicee requested review from jh3y and StephDietz and removed request for a team October 9, 2023 06:53
@ijjk ijjk added the examples Issue was opened via the examples template. label Oct 9, 2023
@leerob leerob merged commit f163dd0 into vercel:canary Nov 16, 2023
53 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue was opened via the examples template. locked
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants