You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get an unhandled error in Next.js when calling observer.error(error);, and I can't retrieve the error just from the getClient result. How can I fix that?
The text was updated successfully, but these errors were encountered:
Algrus8
changed the title
Why observer.error not handling in getClient or useSuspenseQuery?
Why is observer.error not handled in getClient or useSuspenseQuery?
Mar 28, 2024
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.
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?The text was updated successfully, but these errors were encountered: