From 8392c29a1e8751c0b80641094d12298fad160766 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Thu, 16 Mar 2023 09:25:50 -0700 Subject: [PATCH] feat: omit unnecessary sentry logs (#6166) * fix: omit gracefully handled events from sentry * fix: log locale load exception to sentry --- src/components/LiquidityChartRangeInput/index.tsx | 5 ----- src/hooks/useColor.ts | 6 ++---- src/hooks/useFeeTierDistribution.ts | 4 +--- src/lib/i18n.tsx | 3 ++- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/components/LiquidityChartRangeInput/index.tsx b/src/components/LiquidityChartRangeInput/index.tsx index fc42165420..0eb715f9aa 100644 --- a/src/components/LiquidityChartRangeInput/index.tsx +++ b/src/components/LiquidityChartRangeInput/index.tsx @@ -1,5 +1,4 @@ import { Trans } from '@lingui/macro' -import * as Sentry from '@sentry/react' import { Currency, Price, Token } from '@uniswap/sdk-core' import { FeeAmount } from '@uniswap/v3-sdk' import { AutoColumn, ColumnCenter } from 'components/Column' @@ -156,10 +155,6 @@ export default function LiquidityChartRangeInput({ [isSorted, price, ticksAtLimit] ) - if (error) { - Sentry.captureMessage(error.toString(), 'log') - } - const isUninitialized = !currencyA || !currencyB || (formattedData === undefined && !isLoading) return ( diff --git a/src/hooks/useColor.ts b/src/hooks/useColor.ts index 160fbb6267..e02167fbbb 100644 --- a/src/hooks/useColor.ts +++ b/src/hooks/useColor.ts @@ -1,4 +1,3 @@ -import * as Sentry from '@sentry/react' import { Token } from '@uniswap/sdk-core' import { SupportedChainId } from 'constants/chains' import uriToHttp from 'lib/utils/uriToHttp' @@ -39,11 +38,10 @@ async function getColorFromToken(token: Token): Promise { logoURI = URIForEthToken(address) return await getColorFromUriPath(logoURI) } catch (error) { - Sentry.captureMessage(error.toString()) + console.warn(`Unable to load logoURI (${token.symbol}): ${logoURI}`) + return null } } - - return null } async function getColorFromUriPath(uri: string): Promise { diff --git a/src/hooks/useFeeTierDistribution.ts b/src/hooks/useFeeTierDistribution.ts index 377e14e002..1b613ceb48 100644 --- a/src/hooks/useFeeTierDistribution.ts +++ b/src/hooks/useFeeTierDistribution.ts @@ -1,4 +1,3 @@ -import * as Sentry from '@sentry/react' import { Currency, Token } from '@uniswap/sdk-core' import { FeeAmount } from '@uniswap/v3-sdk' import useBlockNumber from 'lib/hooks/useBlockNumber' @@ -89,8 +88,7 @@ function usePoolTVL(token0: Token | undefined, token1: Token | undefined) { } if (latestBlock - (_meta?.block?.number ?? 0) > MAX_DATA_BLOCK_AGE) { - Sentry.captureMessage(`Graph stale (latest block: ${latestBlock})`, 'log') - + console.log(`Graph stale (latest block: ${latestBlock})`) return { isLoading, error, diff --git a/src/lib/i18n.tsx b/src/lib/i18n.tsx index 0c701d663d..a234e63463 100644 --- a/src/lib/i18n.tsx +++ b/src/lib/i18n.tsx @@ -84,7 +84,8 @@ export async function dynamicActivate(locale: SupportedLocale) { // Bundlers will either export it as default or as a named export named default. i18n.load(locale, catalog.messages || catalog.default.messages) } catch (error) { - Sentry.captureMessage(error.toString()) + console.error(error) + Sentry.captureException(new Error(`Unable to load locale (${locale})`)) } i18n.activate(locale) }