support throwing an error on an unsuccessful getParams, getFormData instead of allowing `.data` being undefined
See original GitHub issueDescribe the bug
Often I use getParams like so. I wish getParams
just throw an exception on unsuccessful parse instead of me having to check for it everytime
const parsedFormData = await getParams(formData, someSchema)
// I wish I didn't have to do this every time
if (!parsedFormData.data) throw new Error("no data")
// do something with
parsedFormData.data.someField
Your Example Website or App
every app
Steps to Reproduce the Bug or Issue
as listed
Expected behavior
throwing an exception
Screenshots or Videos
No response
Platform
server
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Next.js keeps throwing error params is undefined
To access id in nextjs. I imported useRouter from next/router. Then I const router = useRouter(). Then const {id} = router.query.
Read more >useQuery & undefined data · Discussion #1331 · TanStack/query
Hi, I've been using react-query for some time now, and so far enjoying it. However, one thing that I find odd is data...
Read more >Solved: "Undefined" Error Upon Form Submission
I cannot reproduce the error using the Same PDF / Data. 3. They have submitted PDF's before (they have contribute level permissions). I...
Read more >Web on Servlet Stack - Spring
The DispatcherServlet , as any Servlet , needs to be declared and mapped according to the Servlet specification by using Java configuration or...
Read more >Intrgormat integration results in The operation failed with an ...
I am trying to use Integromat with my Jotform and it does collect the data but fails trying during the MS Word Template...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’ve already used
getParams
for safe parsing. Also, I think that’s the better default. I’m adding the*OrFail()
versions. This will be pushed out shortly.Closed by 30ab3a1cff39a6d396416a657bb3a0b8c16d7adb