kit icon indicating copy to clipboard operation
kit copied to clipboard

Allow old thrown errors to coexist better with remote function error handling

Open MaxxCorp opened this issue 4 weeks ago • 5 comments

Describe the problem

i can't seem to get the error message of a remote async function to the frontend, when it throws an error.

[e.g. in an async onclick handler on a button in +page.svelte] try { await submit(); // trigger the remote function, here a form() } catch (error) { toast.error(error?.message || 'Oh no! Something went wrong'); }

Never displays the error message thrown on the backend.

Describe the proposed solution

Enhancement: I would like to be able to optionally use thrown errors on the backend remote function instead of returning a result object. This allows me to simply try/catch a remote function call, and then display the error of the promise.

That way, the dev can decide if he wants the promise to fail altogether, or just return an error result.

Alternatives considered

not using thrown errors

Importance

would make my life easier

Additional Information

No response

MaxxCorp avatar Nov 17 '25 12:11 MaxxCorp