-
I'm having an issue with useQuery returning In The query function looks like this:
So I'm not sure what I'm doing wrong where useQuery returns error undefined? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You should rethrow the error in const getAssetData = async (tokenId: string) => {
try {
const response = await axios.get<HttpResponse<AssetType>>(`/api/asset/${tokenId}`);
return response.data;
} catch (err) {
Sentry.captureException(err);
console.error(err);
throw err // <-- need to throw here
}
}; See https://tanstack.com/query/v4/docs/guides/query-functions#handling-and-throwing-errors |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
You should rethrow the error in
getAssetData()
.See https://tanstack.com/query/v4/docs/guides/query-functions#handling-and-throwing-errors