Replies: 1 comment
-
| 
         I'm surprised this isn't covered better in the documentation. I'm looking for a solution to this as well.  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Total beginner with TanStack here.
I was trying to setup a basic form in a Start project, and was wondering what's the best way to gracefully handle errors thrown by the server function.
I want to start the simplest way possible, and then upgrade to the TanStack Form validation on the server + client later. But I guess this is more of a general question on how to deal with errors thrown from a server function.
When I
throw json({ message: "Invalid form data" }, { status: 400 });I can catch it in the client, but the error is not typed. When I log it, I see this output:
Is there a way to infer the type of the error based on the server function return type? Or whats the recommended way to handle these?
Here's an example page:
Beta Was this translation helpful? Give feedback.
All reactions