Observe-only.opts.onError is a side-effect hook — the promise always
rejects regardless of what the callback does or returns.
error is unknown, not AxiosError, because cache-level onError
fires for ANY rejection, including non-axios throws (e.g. errors synthesised
by request interceptors). Narrow with isAxiosError inside the policy.
The returned caches own config.onError. A consumer that needs an
additional cache-level onError must compose it inside opts.onError, not
replace the caches.
Create a
QueryCacheandMutationCachepre-wired with the library's error policy. Pass them to yourQueryClientconstructor:Observe-only.
opts.onErroris a side-effect hook — the promise always rejects regardless of what the callback does or returns.errorisunknown, notAxiosError, because cache-levelonErrorfires for ANY rejection, including non-axios throws (e.g. errors synthesised by request interceptors). Narrow withisAxiosErrorinside the policy.The returned caches own
config.onError. A consumer that needs an additional cache-levelonErrormust compose it insideopts.onError, not replace the caches.