Files
BrowserOS/packages/browseros-agent/apps/agent/lib/sentry/sentryRootErrorHandler.ts
Dani Akash 290ee91a8b Add 'packages/browseros-agent/' from commit '90bd4be3008285bf3825aad3702aff98f872671a'
git-subtree-dir: packages/browseros-agent
git-subtree-mainline: 8f148d0918
git-subtree-split: 90bd4be300
2026-03-13 21:22:09 +05:30

19 lines
761 B
TypeScript

import type ReactDOM from 'react-dom/client'
import { sentry } from './sentry'
/**
* @public
*/
export const sentryRootErrorHandler: ReactDOM.RootOptions = {
// Callback called when an error is thrown and not caught by an ErrorBoundary.
onUncaughtError: sentry.reactErrorHandler((error, errorInfo) => {
// Error caught by sentry, log to console for debugging purposes
// biome-ignore lint/suspicious/noConsole: must log to console for debugging purposes
console.error(error, errorInfo.componentStack)
}),
// Callback called when React catches an error in an ErrorBoundary.
onCaughtError: sentry.reactErrorHandler(),
// Callback called when React automatically recovers from errors.
onRecoverableError: sentry.reactErrorHandler(),
}