Prevent useErrorBoundary from mutate-level onError #511
Unanswered
czterystaczwarty
asked this question in
General
Replies: 3 comments
|
I could conditionally rethrow error from first |
0 replies
|
Technically, you can return a never-resolving promise to |
0 replies
|
For now, I'm throwing the exception myself instead of using const handlerServerErrors = useHandleServerErrors();
const [ mutate ] = useMyOwnQueryHook();
const handleSubmit = async (message) => {
try {
await mutate(payload);
} catch (error) {
return handlerServerErrors(error);
}
};
const useHandleServerErrors = () => {
const setError = useErrorState();
return (errors) => {
if (isErrorToHandleFn(error)) {
// handle error
}
setError(errors); // rethrow to render phase
};
};I just added feature request to cover that case: #539 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to prevent throwing error to render phase to ErrorBoundary, when exception is handled in
mutate-levelonError?Alternatively prevent
useMutation-levelonError:I have one customHook for many API endpoints and I want to have global handling only if the specific one is not defined.
In other words: how to rethrow error to render phase only, when exception was not handled imperatively ?
All reactions