From fe77367837c077a670b505128642ee497b839220 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Mon, 3 Jan 2022 10:29:44 -0330 Subject: [PATCH] Update the Sentry setup log with the build type (#13157) The `environment` field we use for Sentry includes the build type for all build types except `main`, but the log message indicating that Sentry did not include this. This log message is useful for ensuring that Sentry is setup correctly, so it should display the same environment that Sentry is using. It has been updated to do just that. --- app/scripts/lib/setupSentry.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index 0561458e9..052be66ce 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -72,21 +72,6 @@ export default function setupSentry({ release, getState }) { if (METAMASK_DEBUG) { return undefined; - } else if (METAMASK_ENVIRONMENT === 'production') { - if (!process.env.SENTRY_DSN) { - throw new Error( - `Missing SENTRY_DSN environment variable in production environment`, - ); - } - console.log( - `Setting up Sentry Remote Error Reporting for '${METAMASK_ENVIRONMENT}': SENTRY_DSN`, - ); - sentryTarget = process.env.SENTRY_DSN; - } else { - console.log( - `Setting up Sentry Remote Error Reporting for '${METAMASK_ENVIRONMENT}': SENTRY_DSN_DEV`, - ); - sentryTarget = SENTRY_DSN_DEV; } const environment = @@ -94,6 +79,23 @@ export default function setupSentry({ release, getState }) { ? METAMASK_ENVIRONMENT : `${METAMASK_ENVIRONMENT}-${METAMASK_BUILD_TYPE}`; + if (METAMASK_ENVIRONMENT === 'production') { + if (!process.env.SENTRY_DSN) { + throw new Error( + `Missing SENTRY_DSN environment variable in production environment`, + ); + } + console.log( + `Setting up Sentry Remote Error Reporting for '${environment}': SENTRY_DSN`, + ); + sentryTarget = process.env.SENTRY_DSN; + } else { + console.log( + `Setting up Sentry Remote Error Reporting for '${environment}': SENTRY_DSN_DEV`, + ); + sentryTarget = SENTRY_DSN_DEV; + } + Sentry.init({ dsn: sentryTarget, debug: METAMASK_DEBUG,