Skip to content

Commit 19f4a3f

Browse files
docs: clarify rawErrorResponseSchema timing (#5260)
Co-authored-by: Arya Emami <aryaemami59@yahoo.com>
1 parent 906aa2b commit 19f4a3f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

docs/rtk-query/api/createApi.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,15 @@ _(optional, not applicable with `queryFn`)_
938938

939939
[summary](docblock://query/endpointDefinitions.ts?token=EndpointDefinitionWithQuery.rawErrorResponseSchema)
940940

941+
Use `rawErrorResponseSchema` to validate the error value returned by your `baseQuery` **before** `transformErrorResponse` runs.
942+
943+
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.
944+
945+
In practice:
946+
947+
- `rawErrorResponseSchema` validates the original error shape returned from the server or `baseQuery`
948+
- `errorResponseSchema` validates the transformed error shape that ends up in RTK Query's cache and hooks
949+
941950
[examples](docblock://query/endpointDefinitions.ts?token=EndpointDefinitionWithQuery.rawErrorResponseSchema)
942951

943952
#### `metaSchema`

0 commit comments

Comments
 (0)