T
TanStack4mo ago
conscious-sapphire

Sentry setup

Hey, i'm using sentry integration but i have an issue that sentry doesn't capture errors thrown from react components. What's the proper way to use sentry's ErrorBoundary? The only way i could get it to catch is if i wrap individual page components with ErrorBoundary but this is sub-optimal having to wrap every page + errorComponent is useless in that case.
4 Replies
abundant-blush
abundant-blush4mo ago
cc @Cody De Arkland
conscious-sapphire
conscious-sapphireOP4mo ago
ok crap i think i've figured it out, in createRouter i have to use
defaultOnCatch(error, errorInfo) => Sentry.captureReactException(error, errorInfo)
defaultOnCatch(error, errorInfo) => Sentry.captureReactException(error, errorInfo)
instead of ErrorBoundary
eastern-cyan
eastern-cyan4mo ago
☝️ This is right, in createRouter, use the capture exception method
rising-crimson
rising-crimson4mo ago
do you use a separate router instance when passing it to the tanstack router plugin in sentry init?

Did you find this page helpful?