feat: remove amplitude swap error logging (#6306)

This commit is contained in:
eddie 2023-04-05 16:09:07 -07:00 committed by GitHub
parent 40cac44e07
commit 1b2d86ae3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,13 +1,10 @@
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import * as Sentry from '@sentry/react' import * as Sentry from '@sentry/react'
import { sendAnalyticsEvent } from '@uniswap/analytics'
import { SwapEventName } from '@uniswap/analytics-events'
import { ButtonLight, SmallButtonPrimary } from 'components/Button' import { ButtonLight, SmallButtonPrimary } from 'components/Button'
import { ChevronUpIcon } from 'nft/components/icons' import { ChevronUpIcon } from 'nft/components/icons'
import { useIsMobile } from 'nft/hooks' import { useIsMobile } from 'nft/hooks'
import React, { PropsWithChildren, useState } from 'react' import React, { PropsWithChildren, useState } from 'react'
import { Copy } from 'react-feather' import { Copy } from 'react-feather'
import { useLocation } from 'react-router-dom'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { isSentryEnabled } from 'utils/env' import { isSentryEnabled } from 'utils/env'
@ -220,18 +217,14 @@ const updateServiceWorkerInBackground = async () => {
} }
export default function ErrorBoundary({ children }: PropsWithChildren): JSX.Element { export default function ErrorBoundary({ children }: PropsWithChildren): JSX.Element {
const { pathname } = useLocation()
return ( return (
<Sentry.ErrorBoundary <Sentry.ErrorBoundary
fallback={({ error, eventId }) => <Fallback error={error} eventId={eventId} />} fallback={({ error, eventId }) => <Fallback error={error} eventId={eventId} />}
beforeCapture={(scope) => { beforeCapture={(scope) => {
scope.setLevel('fatal') scope.setLevel('fatal')
}} }}
onError={(error) => { onError={() => {
updateServiceWorkerInBackground() updateServiceWorkerInBackground()
if (pathname === '/swap') {
sendAnalyticsEvent(SwapEventName.SWAP_ERROR, { error })
}
}} }}
> >
{children} {children}