Skip to content

Commit

Permalink
feat: move Sentry init to errors package
Browse files Browse the repository at this point in the history
  • Loading branch information
gleiser-oliveira committed Nov 23, 2023
1 parent 072e2ae commit 66d1549
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/App/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as Sentry from '@sentry/react';
import { AnalyticProvider } from 'packages/analytics';
import { ErrorBoundary } from 'packages/errors';
import { LunaUstWarningModal } from 'packages/lunaUstWarning';
import { Web3Wrapper } from 'packages/wallet';
import { Suspense, lazy } from 'react';
Expand All @@ -9,15 +9,15 @@ import { HashRouter } from 'react-router-dom';
import { queryClient } from 'clients/api';
import { Layout } from 'containers/Layout';
import { AuthProvider } from 'context/AuthContext';
import { SentryErrorInfo } from 'packages/errors/SentryErrorInfo';
import { MuiThemeProvider } from 'theme/MuiThemeProvider';

import Router from './Router';
import { SentryErrorInfo } from './SentryErrorInfo';

const NotificationCenter = lazy(() => import('packages/notifications/NotificationCenter'));

const App = () => (
<Sentry.ErrorBoundary>
<ErrorBoundary>
<MuiThemeProvider>
<QueryClientProvider client={queryClient}>
<Web3Wrapper>
Expand All @@ -41,7 +41,7 @@ const App = () => (
</Web3Wrapper>
</QueryClientProvider>
</MuiThemeProvider>
</Sentry.ErrorBoundary>
</ErrorBoundary>
);

export default App;
2 changes: 0 additions & 2 deletions src/initializeLibraries/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import initializeBigNumber from './bigNumber';
import initializeSentry from './sentry';
import initializeYup from './yup';

const initializeLibraries = () => {
initializeBigNumber();
initializeYup();
initializeSentry();
};

export default initializeLibraries;
14 changes: 0 additions & 14 deletions src/initializeLibraries/sentry.ts

This file was deleted.

19 changes: 19 additions & 0 deletions src/packages/errors/ErrorBoundary/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as Sentry from '@sentry/react';
import config from 'config';

import { version as APP_VERSION } from 'constants/version';

export interface ErrorBoundaryProps {
children?: React.ReactNode;
}

Sentry.init({
dsn: config.sentryDsn,
environment: config.environment,
release: APP_VERSION,
attachStacktrace: true,
});

export const ErrorBoundary: React.FC<ErrorBoundaryProps> = ({ children }) => (
<Sentry.ErrorBoundary>{children}</Sentry.ErrorBoundary>
);
File renamed without changes.
1 change: 1 addition & 0 deletions src/packages/errors/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './ErrorBoundary';
export * from './transactionErrors';
export * from './displayMutationError';
export * from './logError';
Expand Down

0 comments on commit 66d1549

Please sign in to comment.