Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: enhance error undefined message #5253

Merged
merged 6 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/query-core/src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export class Query<
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`,
)
}
onError(new Error('undefined') as any)
onError(new Error(`${this.queryHash} data is undefined`) as any)
return
}

Expand Down
2 changes: 1 addition & 1 deletion packages/query-core/src/tests/query.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ describe('query', () => {

await sleep(10)

const error = new Error('undefined')
const error = new Error(`${JSON.stringify(key)} data is undefined`)

expect(observerResult).toMatchObject({
isError: true,
Expand Down
Loading