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