From a064708d8bae6d681c80b0d00ceed2d4d181c503 Mon Sep 17 00:00:00 2001 From: Shubham Kumar Date: Mon, 29 Apr 2024 19:23:57 +0530 Subject: [PATCH] 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. --- .../modules/error-handler/components/AppErrorBoundary.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/twenty-front/src/modules/error-handler/components/AppErrorBoundary.tsx b/packages/twenty-front/src/modules/error-handler/components/AppErrorBoundary.tsx index ecd37e8e2..8e758e67f 100644 --- a/packages/twenty-front/src/modules/error-handler/components/AppErrorBoundary.tsx +++ b/packages/twenty-front/src/modules/error-handler/components/AppErrorBoundary.tsx @@ -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 (