Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Use .safeParse() instead of .parse() #6

Closed
jonahsnider opened this issue Jul 6, 2022 · 1 comment
Closed

Use .safeParse() instead of .parse() #6

jonahsnider opened this issue Jul 6, 2022 · 1 comment

Comments

@jonahsnider
Copy link

https://github.com/vercel-labs/next-swr-endpoints/blob/9c93696201d50f1034544115d47c0ea0291f945b/packages/next-swr-endpoints/src/swr-server-endpoint-loader.ts#L49

.safeParse() will return a result object instead of throwing an error.

@Schniz
Copy link
Collaborator

Schniz commented Jul 7, 2022

I think throwing is better here as it’s simplifying the API (this package has no dependency on zod, you can write your own parser) but we need to return an HTTP 400 if the values don’t match

@jonahsnider jonahsnider closed this as not planned Won't fix, can't repro, duplicate, stale Jul 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants