Tracking quote errors
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { BuyQuote } from '@0x/asset-buyer';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { AffiliateInfo, Asset, Network, OrderSource, ProviderState, QuoteFetchedVia } from '../types';
|
||||
@@ -184,4 +185,19 @@ export const analytics = {
|
||||
...buyQuoteEventProperties(buyQuote),
|
||||
fetchedVia,
|
||||
}),
|
||||
trackQuoteError: (
|
||||
errorMessage: string,
|
||||
assetName: string,
|
||||
assetData: string,
|
||||
assetAmount: BigNumber,
|
||||
fetchedVia: QuoteFetchedVia,
|
||||
) => {
|
||||
trackingEventFnWithPayload(EventNames.QUOTE_ERROR)({
|
||||
errorMessage,
|
||||
assetName,
|
||||
assetData,
|
||||
assetAmount: assetAmount.toString(),
|
||||
fetchedVia,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -37,6 +37,13 @@ export const buyQuoteUpdater = {
|
||||
} catch (error) {
|
||||
if (options.dispatchErrors) {
|
||||
dispatch(actions.setQuoteRequestStateFailure());
|
||||
analytics.trackQuoteError(
|
||||
error.message ? error.message : 'other',
|
||||
asset.metaData.name,
|
||||
asset.assetData,
|
||||
assetUnitAmount,
|
||||
options.fetchedVia,
|
||||
);
|
||||
let errorMessage;
|
||||
if (error.message === AssetBuyerError.InsufficientAssetLiquidity) {
|
||||
const assetName = assetUtils.bestNameForAsset(asset, 'of this asset');
|
||||
|
||||
Reference in New Issue
Block a user