Vue OpenAPI Query Documentation
    Preparing search index...

    Function createApiErrorCaches

    • Create a QueryCache and MutationCache pre-wired with the library's error policy. Pass them to your QueryClient constructor:

      const { queryCache, mutationCache } = createApiErrorCaches({
      onError(error, ctx) {
      // observe-only: the promise always rejects afterwards.
      showErrorBanner(ctx.operationId)
      }
      })
      const queryClient = new QueryClient({ queryCache, mutationCache })

      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.

      Parameters

      Returns { queryCache: QueryCache; mutationCache: MutationCache }