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:
@ -1,11 +1,15 @@
|
|||||||
import { ErrorInfo, ReactNode } from 'react';
|
import { ErrorInfo, ReactNode } from 'react';
|
||||||
import { ErrorBoundary } from 'react-error-boundary';
|
import { ErrorBoundary } from 'react-error-boundary';
|
||||||
|
import * as Sentry from '@sentry/react';
|
||||||
|
|
||||||
import { GenericErrorFallback } from '@/error-handler/components/GenericErrorFallback';
|
import { GenericErrorFallback } from '@/error-handler/components/GenericErrorFallback';
|
||||||
|
|
||||||
export const AppErrorBoundary = ({ children }: { children: ReactNode }) => {
|
export const AppErrorBoundary = ({ children }: { children: ReactNode }) => {
|
||||||
const handleError = (_error: Error, _info: ErrorInfo) => {
|
const handleError = (_error: Error, _info: ErrorInfo) => {
|
||||||
// TODO: log error to Sentry
|
Sentry.captureException(_error, (scope) => {
|
||||||
|
scope.setExtras({ _info });
|
||||||
|
return scope;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user