chore: add sentry captureException for global error logging (#5198)

I have added error logging to Sentry using Sentry.captureException. The
_info object which includes the componentStack will be sent in extra
data along with the exception.
This commit is contained in:
Shubham Kumar
2024-04-29 19:23:57 +05:30
committed by GitHub
parent 6cafd25c97
commit a064708d8b

View File

@ -1,11 +1,15 @@
import { ErrorInfo, ReactNode } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import * as Sentry from '@sentry/react';
import { GenericErrorFallback } from '@/error-handler/components/GenericErrorFallback';
export const AppErrorBoundary = ({ children }: { children: ReactNode }) => {
const handleError = (_error: Error, _info: ErrorInfo) => {
// TODO: log error to Sentry
Sentry.captureException(_error, (scope) => {
scope.setExtras({ _info });
return scope;
});
};
return (