Error Handling through API
Hey peeps, i am building an App with the t3 stack, so far one of the best experiences i've had,
was mainly a react native / Expo dev 2 years prior.
This is my first exposure to backend development too. The toolchain chosen in t3 makes it easy to get started.
but on to my question. I am looking for what's considered best practice regarding error handling.
i have a procedure
createMember
that writes a member to the DB
it looks something like this:
i then expose the error to the client through the onError
method on my useCreateMember
hook
it works just fine. My question is if this is considered "the way" to do it.
My Prisma Schema already defines the email as a unique attribute on the member table.
So the db should reject no matter the error handling api wise, right?
Is there a way to get the DB error through to the client?
appreciate the help.
thanks all in advance and have a great weekend.
XO Alex4 Replies
Hey, I am trying to create the T3 App on my chromebook but the command does not run in terminal, can anyone help please?
Why are you posting this on every thread lol
is there a specific thread for this problem?
No, but you can make your own!
Just click on #questions
and make a thread
oh you've made one cool 👍