-
After reading TkDodo's artcile about global error handling in RQ I came with an idea to do the following:
1) For the global error handling I understand there are 2 options: a. Set an mutationCache: new MutationCache({
onError: error => {
console.log('Mutation error:', error);
},
}), The problem here being that I don't see a way of knowing that the error was already handled locally. In which case I wouldn't want to act and just ignore it b. Set an defaultOptions: {
mutations: {
onError: error => {
console.log('Mutation error:', error);
},
},
}, The problem here is that it wouldn't run for any mutations that have a local useMutation(createNewUser, {
onSuccess: () => {
// Do stuff..
},
onError: err => {
if (err.status === 400) {
// Server rejected the form (common use case), render validation errors to the user in the form
} else {
// We don't expect this kind of error meaning it's a bug
throw err; // Re-throw the error so that it's handled globally (display application error)
}
},
}); So my question is, is this possible? Is there a way to re-throw errors in the local |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
no, there is no such thing. the global error handlers are always called. |
Beta Was this translation helpful? Give feedback.
no, there is no such thing. the global error handlers are always called.