From 2f762a8599a67cc578a7150d7ea806b9dc65d322 Mon Sep 17 00:00:00 2001 From: Michael Chappell <7581002+mchappell@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:45:42 +0000 Subject: [PATCH] fix(extension): use debug statements in favour of error (#1738) - don't catch console errors in production --- apps/browser-extension-wallet/sentry.js | 3 ++- .../src/lib/scripts/background/onError.ts | 2 +- .../src/lib/scripts/background/services/utilityServices.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/browser-extension-wallet/sentry.js b/apps/browser-extension-wallet/sentry.js index 9bf818ff33..f0e803aa64 100644 --- a/apps/browser-extension-wallet/sentry.js +++ b/apps/browser-extension-wallet/sentry.js @@ -8,7 +8,8 @@ Sentry.init({ Sentry.browserTracingIntegration(), Sentry.browserProfilingIntegration(), Sentry.replayIntegration(), - Sentry.captureConsoleIntegration({ levels: ['error'] }) + // TODO: re-enable once we've reviewed provider logging + Sentry.captureConsoleIntegration({ levels: process.env.SENTRY_ENVIRONMENT === 'production' ? [] : ['error'] }) ], // Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled tracePropagationTargets: ['localhost', 'chrome-extension://gafhhkghbfjjkeiendhlofajokpaflmk'], diff --git a/apps/browser-extension-wallet/src/lib/scripts/background/onError.ts b/apps/browser-extension-wallet/src/lib/scripts/background/onError.ts index 9f618f4e3e..05deb7568c 100644 --- a/apps/browser-extension-wallet/src/lib/scripts/background/onError.ts +++ b/apps/browser-extension-wallet/src/lib/scripts/background/onError.ts @@ -46,7 +46,7 @@ const handleConnectionIssues = async (error: WebRequest.OnErrorOccurredDetailsTy ) return; - logger.error('xmlhttprequest:net::ERR_INTERNET_DISCONNECTED', error); + logger.debug('xmlhttprequest:net::ERR_INTERNET_DISCONNECTED', error); requestMessage$.next({ type: MessageTypes.HTTP_CONNECTION, data: { connected: false } }); if (!webRequest.onCompleted.hasListener(handleRequests)) { diff --git a/apps/browser-extension-wallet/src/lib/scripts/background/services/utilityServices.ts b/apps/browser-extension-wallet/src/lib/scripts/background/services/utilityServices.ts index c02d2808c0..2f48a8358f 100644 --- a/apps/browser-extension-wallet/src/lib/scripts/background/services/utilityServices.ts +++ b/apps/browser-extension-wallet/src/lib/scripts/background/services/utilityServices.ts @@ -178,7 +178,7 @@ const fetchTokenPrices = () => { coinPrices.tokenPrices$.next({ tokens: tokenPrices, status: 'fetched' }); }) .catch((error) => { - logger.error('Error fetching coin prices:', error); + logger.debug('Error fetching token prices:', error); coinPrices.tokenPrices$.next({ ...coinPrices.tokenPrices$.value, status: 'error' }); }); }; @@ -204,7 +204,7 @@ const fetchAdaPrice = () => { }); }) .catch(async (error) => { - logger.error('Error fetching coin prices:', error); + logger.debug('Error fetching coin prices:', error); // If for some reason we couldn't fetch the ada price, get it from background store const adaPrice = await getADAPriceFromBackgroundStorage(); if (!adaPrice) return coinPrices.adaPrices$.next({ prices: {}, status: 'error', timestamp: undefined });