How do I pass a custom error from my backend to frontend?

How do I pass a custom error from my backend to frontend?
4 Replies
Matvey
Matvey2y ago
Error Handling | tRPC
Whenever an error occurs in a procedure, tRPC responds to the client with an object that includes an "error" property. This property contains all the information that you need to handle the error in the client.
Matvey
Matvey2y ago
Don't ask questions, that can be answered in one simple google search
shikishikichangchang
The error I need to handled is thrown by my createContext. Any idea how to handle that?
rocawear
rocawear2y ago
Request Context | tRPC
The createContext() function is called for each request, and the result is propagated to all resolvers. You can use this to pass contextual data down to the resolvers.
Want results from more Discord servers?
Add your server