Skip to content

Commit

Permalink
refactor: enhance error undefined message (#5253)
Browse files Browse the repository at this point in the history
* refactor: enhance error undefined message

* Update packages/query-core/src/query.ts

* chore: fix test:lib undefined message

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
Co-authored-by: DylanJu <dylan@daangnpay.com>
  • Loading branch information
3 people committed Apr 24, 2023
1 parent 7cd2d19 commit dc2af81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/query-core/src/query.ts
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
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

0 comments on commit dc2af81

Please sign in to comment.