Open Algrus8 opened 7 months ago
In the useSuspenseQuery
case, you should use an error boundary - and I believe in the await getClient().query
case you can either use a try..catch
block, or also an error boundary.
Yes, I can handle this error with a try-catch
, but can I do something to get it just from this error const { data, error } = await getClient().query
?
You could set the errorPolicy
in your query
call options - the default is none
, which will throw
, but you could also set errorPolicy: "all"
which would make it accessible the way you want to here.
Hello! I have this code:
This is my
getClient
definition:And when I use
useQuery
from '@apollo/client', everything works correctly. However, when I usegetClient
oruseSuspenseQuery
, for example:I get an unhandled error in Next.js when calling
observer.error(error);
, and I can't retrieve the error just from thegetClient
result. How can I fix that?