Skip to content

Commit 4ddfcc9

Browse files
authored
update multiple requests with queryFn example
returning object with error property instead of throwing error
1 parent c87f803 commit 4ddfcc9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/rtk-query/usage/customizing-queries.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ const api = createApi({
939939
async queryFn(_arg, _queryApi, _extraOptions, fetchWithBQ) {
940940
// get a random user
941941
const randomResult = await fetchWithBQ('users/random')
942-
if (randomResult.error) throw randomResult.error
942+
if (randomResult.error) return { error: randomResult.error as FetchBaseQueryError }
943943
const user = randomResult.data as User
944944
const result = await fetchWithBQ(`user/${user.id}/posts`)
945945
return result.data

0 commit comments

Comments
 (0)