Throw custom TRPCError with specific cause
Hello everyone !
I'm trying to throw a custom TRPCError with a specific cause that i can differentiate from other trpc errors. My use case is to be able to catch error on client and display an error message if the error code is 'BAD_REQUEST' and a specific cause. After investigating i find that something like this should work in my mutation procedure:
But in my errorFormatter i only receive this object cause field is not present.
Can someone enlighten me on how to solve this problem ?
Thanks
I'm trying to throw a custom TRPCError with a specific cause that i can differentiate from other trpc errors. My use case is to be able to catch error on client and display an error message if the error code is 'BAD_REQUEST' and a specific cause. After investigating i find that something like this should work in my mutation procedure:
But in my errorFormatter i only receive this object cause field is not present.
Can someone enlighten me on how to solve this problem ?
Thanks