From 926fcb296fb728c3520c638a43a5da950393832e Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Fri, 14 Dec 2018 14:06:24 -0800 Subject: fix(instant): treat executeBuyQuote errors as signature denials --- packages/instant/src/components/buy_button.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'packages/instant/src/components') diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx index 1489b94d4..880303cc7 100644 --- a/packages/instant/src/components/buy_button.tsx +++ b/packages/instant/src/components/buy_button.tsx @@ -10,6 +10,7 @@ import { WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX } from '../constants' import { ColorOption } from '../style/theme'; import { AffiliateInfo, Asset, ZeroExInstantError } from '../types'; import { analytics } from '../util/analytics'; +import { errorReporter } from '../util/error_reporter'; import { gasPriceEstimator } from '../util/gas_price_estimator'; import { util } from '../util/util'; @@ -82,14 +83,17 @@ export class BuyButton extends React.Component { }); } catch (e) { if (e instanceof Error) { - if (e.message === AssetBuyerError.SignatureRequestDenied) { - analytics.trackBuySignatureDenied(buyQuote); - this.props.onSignatureDenied(buyQuote); - return; - } else if (e.message === AssetBuyerError.TransactionValueTooLow) { + if (e.message === AssetBuyerError.TransactionValueTooLow) { analytics.trackBuySimulationFailed(buyQuote); this.props.onValidationFail(buyQuote, AssetBuyerError.TransactionValueTooLow); return; + } else { + if (e.message !== AssetBuyerError.SignatureRequestDenied) { + errorReporter.report(e); + } + analytics.trackBuySignatureDenied(buyQuote); + this.props.onSignatureDenied(buyQuote); + return; } } throw e; -- cgit