Replies: 1 comment 2 replies
-
Hi, This is already possible when setting up the This should work for you: const queryCache = new QueryCache({
onError: (error, query) => {
console.log(error); // handle global error
},
});
const vueQueryPluginOptions: VueQueryPluginOptions = {
queryClientConfig: { queryCache },
};
const app = createApp(App)
.use(VueQueryPlugin, vueQueryPluginOptions)
.mount("#app"); |
Beta Was this translation helpful? Give feedback.
2 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.
-
I don't want to handle errors on a per-query basis. I want to handle errors globally. Simply by showing a toast / notification to the user saying something along the lines of "Sorry, something went wrong...". Would you be willing to add something like that. Ideally the lastError is not a boolean, but an object with details about the error. Namely, was it a fetching error, or a mutating error? With which key was the error associated, if any? Things like that.
That way I can write a single global error handler that displays the most useful message to the user possible.
Beta Was this translation helpful? Give feedback.
All reactions