what does returning an error from a server function do? I don't see it in the console anywhere.
I see the documentation recommends returning an error instead of throwing it, what does that do actually? where can I see the error? how can I handle the error on the client and show a toast or something else
6 Replies
You can return an error from an action and then useSubmission
https://docs.solidjs.com/solid-router/concepts/actions
So have the submission inside a createEffect and a switch statement is the way to go?
Well an action would normally be triggered from some kind of event handler
My usecase would be a form is submitted the action returns and error "Not Found" and now I want to toast this. How would you go about it?
cost submission = useSubmission(actionFunction)
Then use submission.result in the jsx
If you want a toast you might have to use createEffect... You may be right
Thanks, makes sense, seems a lot more complicated though than necessary, maybe there is a good reason its this way