Commit 27d91529 authored by eddie's avatar eddie Committed by GitHub

fix: add amplitude event for uniswapX orders failing to post (#6977)

parent 3cb06928
...@@ -106,6 +106,16 @@ export function useUniswapXSwapCallback({ ...@@ -106,6 +106,16 @@ export function useUniswapXSwapCallback({
// TODO(UniswapX): For now, `errorCode` is not always present in the response, so we have to fallback // TODO(UniswapX): For now, `errorCode` is not always present in the response, so we have to fallback
// check for status code and perform this type narrowing. // check for status code and perform this type narrowing.
if (isErrorResponse(res, body)) { if (isErrorResponse(res, body)) {
sendAnalyticsEvent('UniswapX Order Post Error', {
...formatSwapSignedAnalyticsEventProperties({
trade,
allowedSlippage,
fiatValues,
}),
...analyticsContext,
errorCode: body.errorCode,
detail: body.detail,
})
// TODO(UniswapX): Provide a similar utility to `swapErrorToUserReadableMessage` once // TODO(UniswapX): Provide a similar utility to `swapErrorToUserReadableMessage` once
// backend team provides a list of error codes and potential messages // backend team provides a list of error codes and potential messages
throw new Error(`${body.errorCode ?? body.detail ?? 'Unknown error'}`) throw new Error(`${body.errorCode ?? body.detail ?? 'Unknown error'}`)
......
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