React Query and Error Handling

i currently watching the React Intermediate course and i do not understand the error handling mechanism of react query.

for the queryFN: i provide the following arrow function:

() => axios.get('url').then(res => return

Why does react query know about the error that axios has if something went wrong? I’m returning the data and not the promise where ‘.catch()’ could be used by react query.

Could you help me to understand how this works?

Sorry, somehow i have totally misunderstood this part. Of course i’m returning a promise. The return statement inside the “then” function only represents what is returned by resolving the promise.