T
TanStack5mo ago
foreign-sapphire

Global "onError" handler

Hello! I'm looking to implement the following logic:
onError: (error) => {
error.data.code === "NOT_FOUND" && notFound({ throw: true });
}
onError: (error) => {
error.data.code === "NOT_FOUND" && notFound({ throw: true });
}
globally. But there isn't a "defaultOnError". How can i do this?
3 Replies
silky-coral
silky-coral5mo ago
sounds like something we could add want to create a PR for this?
foreign-sapphire
foreign-sapphireOP5mo ago
I will try to give it a go!! Any caveats I should be aware vs the implementation of “defaultOnCatch”?
silky-coral
silky-coral5mo ago
not aware of any let's just try it out and we will see

Did you find this page helpful?