refactor: log NO_ROUTE found instead of paging (#7242)

* refactor: log no route found instead of paging

* typo

* log router preference

---------

Co-authored-by: Charles Bachmeier <charlie@genie.xyz>
This commit is contained in:
Charles Bachmeier 2023-08-29 13:59:51 -07:00 committed by GitHub
parent bed144b994
commit 1eab4291f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,7 @@
import { createApi, fetchBaseQuery, FetchBaseQueryError } from '@reduxjs/toolkit/query/react' import { createApi, fetchBaseQuery, FetchBaseQueryError } from '@reduxjs/toolkit/query/react'
import * as Sentry from '@sentry/react'
import { Protocol } from '@uniswap/router-sdk' import { Protocol } from '@uniswap/router-sdk'
import { TradeType } from '@uniswap/sdk-core' import { TradeType } from '@uniswap/sdk-core'
import { sendAnalyticsEvent } from 'analytics'
import { isUniswapXSupportedChain } from 'constants/chains' import { isUniswapXSupportedChain } from 'constants/chains'
import { getClientSideQuote } from 'lib/hooks/routing/clientSideSmartOrderRouter' import { getClientSideQuote } from 'lib/hooks/routing/clientSideSmartOrderRouter'
import ms from 'ms' import ms from 'ms'
@ -166,10 +166,10 @@ export const routingApi = createApi({
typeof errorData === 'object' && typeof errorData === 'object' &&
(errorData?.errorCode === 'NO_ROUTE' || errorData?.detail === 'No quotes available') (errorData?.errorCode === 'NO_ROUTE' || errorData?.detail === 'No quotes available')
) { ) {
Sentry.withScope((scope) => { sendAnalyticsEvent('No quote received from routing API', {
scope.setExtra('requestBody', requestBody) requestBody,
scope.setExtra('response', response) response,
Sentry.captureException(new Error("No routes found for user's quote request, alert Routing Team")) routerPreference: args.routerPreference,
}) })
return { return {
data: { state: QuoteState.NOT_FOUND, latencyMs: getQuoteLatencyMeasure(quoteStartMark).duration }, data: { state: QuoteState.NOT_FOUND, latencyMs: getQuoteLatencyMeasure(quoteStartMark).duration },