Commit c45492c8 authored by eddie's avatar eddie Committed by GitHub

feat: log swap errors to sentry (#6698)

* feat: log swap errors to sentry

* fix: dont stringify
parent 41219b43
import { Trans } from '@lingui/macro' import { Trans } from '@lingui/macro'
import * as Sentry from '@sentry/react'
import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from '@uniswap/analytics' import { sendAnalyticsEvent, Trace, TraceEvent, useTrace } from '@uniswap/analytics'
import { import {
BrowserEvent, BrowserEvent,
...@@ -440,6 +441,12 @@ export function Swap({ ...@@ -440,6 +441,12 @@ export function Swap({
}) })
}) })
.catch((error) => { .catch((error) => {
if (!didUserReject(error)) {
Sentry.withScope((scope) => {
scope.setExtra('confirmedTrade', tradeToConfirm)
Sentry.captureException(error)
})
}
setSwapState((currentState) => ({ setSwapState((currentState) => ({
...currentState, ...currentState,
swapError: error, swapError: error,
...@@ -454,6 +461,7 @@ export function Swap({ ...@@ -454,6 +461,7 @@ export function Swap({
account, account,
trade?.inputAmount?.currency?.symbol, trade?.inputAmount?.currency?.symbol,
trade?.outputAmount?.currency?.symbol, trade?.outputAmount?.currency?.symbol,
tradeToConfirm,
]) ])
// errors // errors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment