tRPCttRPC
Powered by
rdR
tRPC•3y ago•
3 replies
rd

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!
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Route not found when using Fastify adapter
TeixeiraTTeixeira / ❓-help
13mo ago
SSG on nextJS when appRouter is made with fastify adapter?
DelvisDDelvis / ❓-help
4y ago
Using Next.JS + Fastify
BrycensRanchBBrycensRanch / ❓-help
3y ago