-
Notifications
You must be signed in to change notification settings - Fork 172
Closed
Description
Describe the bug
Let's consider this example:
const myAction = action(() => throw new Error("Some error"));
// somewhere in a component
const doMyAction = useAction(myAction);
doMyAction().then(() => {
// this function will always be executed despite the fact that the action failed.
console.log('Action resolves without any error');
}, (error) => {
// this function will never catch an error
console.error('An error occured');
});This error relates to this line: https://github.com/solidjs/solid-router/blob/main/src/data/action.ts#L97
Perhaps, handler should check the argument type (to preserve the current possibility to throw redirect or revalidate) and throw an error if the argument is not solid-related thing.
Your Example Website or App
see description
Steps to Reproduce the Bug or Issue
run this code
const myAction = action(() => throw new Error("Some error"));
// somewhere in a component
const doMyAction = useAction(myAction);
doMyAction().then(() => {
// this function will always be executed despite the fact that the action failed.
console.log('Action resolves without any error');
}, (error) => {
// this function will never catch an error
console.error('An error occured');
});```
### Expected behavior
Error handler should handle errors.
### Screenshots or Videos
_No response_
### Platform
any
### Additional context
_No response_Metadata
Metadata
Assignees
Labels
No labels