Skip to content

Conversation

@boschni
Copy link
Collaborator

@boschni boschni commented Dec 22, 2020

This PR adds global onError callbacks to QueryCache and MutationCache.

const queryCache = new QueryCache({
  onError: error => {
    console.log(error)
  },
})

const mutationCache = new MutationCache({
  onError: error => {
    console.log(error)
  },
})

While it is possible to set onError in defaultOptions, it will not be called when a hook defines its own onError.

@vercel
Copy link

vercel bot commented Dec 22, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/evh470t6q
✅ Preview: https://react-query-git-feature-add-error-callbacks.tannerlinsley.vercel.app

@tannerlinsley tannerlinsley merged commit 77f434c into master Dec 22, 2020
@tannerlinsley tannerlinsley deleted the feature/add-error-callbacks branch December 22, 2020 17:58
@tannerlinsley
Copy link
Member

🎉 This PR is included in version 3.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants