Closed xstevenyung closed 3 years ago
Hello, Thanks a lot :) To determine a query has errored, the query function must throw. Any error that is thrown in the query function will be persisted on the error state of the query. docs: https://sveltequery.vercel.app/guides/query-functions#handling-and-throwing-errors
example: https://codesandbox.io/s/eager-hawking-ykdml?file=/src/Simple.svelte
Thanks
Oops my bad, I totally forgot that fetch
doesn't throw errors on failed request by default!
Thanks a lot for the quick response !
Hello,
Thanks a lot for the project and the work put into it, really appreciate having a port of react-query in the Svelte ecosystem!
I notice recently trying to implement error handling logic that queries never really "fail", here an example based on the simple example: https://codesandbox.io/s/optimistic-lumiere-j08we?file=/src/Simple.svelte:0-65
As you can see, I'm hitting a random URL on GitHub which will return a 404 but even when the query fails,
$queryResult.error
isnull
.I also tried on a blank Svelte project and the same issue occurs.
I'm going to investigate a little more in the project to figure where exactly the problem lies.
Thanks again for your work