Can i use try/catch in procedures?

Bbetafuzz5/2/2023
can i use try/catch in procedures to pass the error when catching errors in my functions?
Nnlucas5/2/2023
Yes
Bbetafuzz5/2/2023
can i pass the error from function to trpc
Bbetafuzz5/2/2023
like i need to cast the TRPCError({error})?
Bbetafuzz5/2/2023
try {
    ....
catch(err) {
  throw new TRPCError(err)
}
Nnlucas5/2/2023
You don’t need to do the wrapping yourself, tRPC does that automatically. If you need to throw an error just throw it and then you can use an errorFormatter to manipulate what gets sent to the client