Throwing fastify errors when using fastify adapter
Hello, I'm using
fastifyTRPCPlugin
fastifyTRPCPlugin
from
@trpc/server/adapters/fastify
@trpc/server/adapters/fastify
and trying to throw errors correctly.
I usually use
@fastify-sensible
@fastify-sensible
because I find the API clear, e.g. I can write things like
fastify.httpErrors.forbidden()
fastify.httpErrors.forbidden()
or
fastify.httpErrors.unauthorized
fastify.httpErrors.unauthorized
.
However if I throw one of these in a tRPC procedure it seems the error code is always 500, assuming that's because tRPC is intercepting/handling them in some way? What's the best way to "solve" this? Thanks!