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
brenelz
brenelz6mo ago
You can return an error from an action and then useSubmission https://docs.solidjs.com/solid-router/concepts/actions
Raqueebuddin Aziz
Raqueebuddin AzizOP6mo ago
So have the submission inside a createEffect and a switch statement is the way to go?
brenelz
brenelz6mo ago
Well an action would normally be triggered from some kind of event handler
Raqueebuddin Aziz
Raqueebuddin AzizOP6mo ago
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?
brenelz
brenelz6mo ago
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
Raqueebuddin Aziz
Raqueebuddin AzizOP6mo ago
Thanks, makes sense, seems a lot more complicated though than necessary, maybe there is a good reason its this way

Did you find this page helpful?