pes04
Question about onError and modifying error messages in tRPC
I’m trying to follow the tRPC docs on error handling and want to log detailed errors on the server by throwing specific exceptions but send a generic message to the client (see https://trpc.io/docs/server/error-handling#handling-errors).
I thought this would work:
But it doesn’t seem to have any effect — the original error is still sent to the client. According to the docs, I assumed mutating opts.error would override the one sent to the client. Am I misunderstanding something, or is there another way to do this?
Thanks in advance.
6 replies