feat: log swap errors to sentry (#6698)

* feat: log swap errors to sentry

* fix: dont stringify
This commit is contained in:
eddie 2023-06-06 13:31:46 -07:00 committed by GitHub
parent 41219b435f
commit c45492c890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
import { Trans } from '@lingui/macro'
import * as Sentry from '@sentry/react'
import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from '@uniswap/analytics'
import {
BrowserEvent,
@ -440,6 +441,12 @@ export function Swap({
})
})
.catch((error) => {
if (!didUserReject(error)) {
Sentry.withScope((scope) => {
scope.setExtra('confirmedTrade', tradeToConfirm)
Sentry.captureException(error)
})
}
setSwapState((currentState) => ({
...currentState,
swapError: error,
@ -454,6 +461,7 @@ export function Swap({
account,
trade?.inputAmount?.currency?.symbol,
trade?.outputAmount?.currency?.symbol,
tradeToConfirm,
])
// errors