From e07fa23e0de857ce9a0353c3a3ad392bfdee4fda Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 5 Oct 2023 16:48:20 -0500 Subject: [PATCH] Let Sentry DSN be configurable in SoapboxConfig --- src/features/soapbox-config/index.tsx | 14 ++++++++++++++ src/sentry.ts | 13 ------------- 2 files changed, 14 insertions(+), 13 deletions(-) delete mode 100644 src/sentry.ts diff --git a/src/features/soapbox-config/index.tsx b/src/features/soapbox-config/index.tsx index 15295e212..ffe91e123 100644 --- a/src/features/soapbox-config/index.tsx +++ b/src/features/soapbox-config/index.tsx @@ -54,6 +54,8 @@ const messages = defineMessages({ tileServerAttributionLabel: { id: 'soapbox_config.tile_server_attribution_label', defaultMessage: 'Map tiles attribution' }, redirectRootNoLoginLabel: { id: 'soapbox_config.redirect_root_no_login_label', defaultMessage: 'Redirect homepage' }, redirectRootNoLoginHint: { id: 'soapbox_config.redirect_root_no_login_hint', defaultMessage: 'Path to redirect the homepage when a user is not logged in.' }, + sentryDsnLabel: { id: 'soapbox_config.sentry_dsn_label', defaultMessage: 'Sentry DSN' }, + sentryDsnHint: { id: 'soapbox_config.sentry_dsn_hint', defaultMessage: 'DSN URL for error reporting. Works with Sentry and GlitchTip.' }, }); type ValueGetter = (e: React.ChangeEvent) => any; @@ -285,6 +287,18 @@ const SoapboxConfig: React.FC = () => { onChange={handleChange(['redirectRootNoLogin'], (e) => e.target.value)} /> + + + e.target.value)} + /> + diff --git a/src/sentry.ts b/src/sentry.ts deleted file mode 100644 index ac454501a..000000000 --- a/src/sentry.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { CaptureContext } from '@sentry/types'; - -/** Capture the exception in Sentry. */ -async function captureException (exception: any, captureContext?: CaptureContext | undefined): Promise { - try { - const Sentry = await import('@sentry/react'); - Sentry.captureException(exception, captureContext); - } catch (e) { - console.error(e); - } -} - -export { startSentry, captureException }; \ No newline at end of file