danecandoD
tRPC9mo 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 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.
Was this page helpful?