tRPCttRPC
Powered by
danecandoD
tRPC•10mo ago•
1 reply
danecando

Best way to wrap procedure for error handling

Wondering what's the most idiomatic way to accomplish this?

I want to have a try { } catch {} that wraps each procedure and returns a generic error for uncaught (non trpc) errors

It is to just created a wrapper fn ie
withErrorHandling
withErrorHandling
that you wrap all your procedures with?

I tried middleware but it doesn't seem like you can return a different value for the error.
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

Best way to implement input based validation on a router procedure
JavascriptMickJJavascriptMick / ❓-help
3y ago
error handling
SzymonSSzymon / ❓-help
13mo ago