-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
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