From f462e154ebf8281e1b42452986c19eef62407a21 Mon Sep 17 00:00:00 2001 From: lilianakatrina684-a11y Date: Sun, 22 Mar 2026 02:33:01 +0800 Subject: [PATCH] docs: clarify rawErrorResponseSchema timing --- docs/rtk-query/api/createApi.mdx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/rtk-query/api/createApi.mdx b/docs/rtk-query/api/createApi.mdx index 17dbf54705..e8413ec81f 100644 --- a/docs/rtk-query/api/createApi.mdx +++ b/docs/rtk-query/api/createApi.mdx @@ -938,6 +938,15 @@ _(optional, not applicable with `queryFn`)_ [summary](docblock://query/endpointDefinitions.ts?token=EndpointDefinitionWithQuery.rawErrorResponseSchema) +Use `rawErrorResponseSchema` to validate the error value returned by your `baseQuery` **before** `transformErrorResponse` runs. + +This is the error-side equivalent of `rawResponseSchema`. If you want to validate the final value that your endpoint exposes after `transformErrorResponse`, use [`errorResponseSchema`](#errorresponseschema) instead. + +In practice: + +- `rawErrorResponseSchema` validates the original error shape returned from the server or `baseQuery` +- `errorResponseSchema` validates the transformed error shape that ends up in RTK Query's cache and hooks + [examples](docblock://query/endpointDefinitions.ts?token=EndpointDefinitionWithQuery.rawErrorResponseSchema) #### `metaSchema`