How to map internal errors to TRPCError types?
Hi, my application is throwing it's own set of custom Errors.
Unfortunatelly tRPC always catch this errors and represent them as UNEXPECTED_SERVER_ERROR type.
I tried following:
I ended up wrapping all of my mutation/query handlers in following function:
I just wanted to ask if there isn't better way of doing this - eg. I believe this is exactly what middleware is supposed to do - apply code per each handler so you don't need to.
How can I get anything else than TRPCError in middleware?
Unfortunatelly tRPC always catch this errors and represent them as UNEXPECTED_SERVER_ERROR type.
I tried following:
I ended up wrapping all of my mutation/query handlers in following function:
I just wanted to ask if there isn't better way of doing this - eg. I believe this is exactly what middleware is supposed to do - apply code per each handler so you don't need to.
How can I get anything else than TRPCError in middleware?