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
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.
Don't ask questions, that can be answered in one simple google search
The error I need to handled is thrown by my createContext. Any idea how to handle that?
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.