Hi!
We have a React app running Sentry through @sentry/react: "^6.8.0"
. We setup an Error Boundary to capture errors and load a fallback error component in our index.js
file, which works generally fine for errors in rendered components.
However, this boundary seems to ignore any errors thrown inside of React Context Providers. For example, we have a Provider called AccountsProvider
, which makes a graphql call to our node backend (using Apollo) and stores the details of the currently logged in account.
We’ve setup Apollo with an onError
link and handle all graphql errors in that, but if the errors are thrown in that link or anywhere else in AccountsProvider
it does not trigger the Error Boundary or render the fallback,
Is this the expected behaviour for Sentry? If so, how would I appropriately log the error to Sentry and still maintain all my tracing integrations etc.? (i.e. is it sufficient to just use Sentry.captureException
inside the AccountsProvider
itself?)
Thanks in advance!