aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-12-15 06:06:24 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-12-15 06:06:24 +0800
commit926fcb296fb728c3520c638a43a5da950393832e (patch)
tree5c0e9f6f5f31fab45fa96473293914a6302ab2bf
parent6d45beccad44e86ddd692d0cf54c09c29c5d9daf (diff)
downloaddexon-sol-tools-926fcb296fb728c3520c638a43a5da950393832e.tar
dexon-sol-tools-926fcb296fb728c3520c638a43a5da950393832e.tar.gz
dexon-sol-tools-926fcb296fb728c3520c638a43a5da950393832e.tar.bz2
dexon-sol-tools-926fcb296fb728c3520c638a43a5da950393832e.tar.lz
dexon-sol-tools-926fcb296fb728c3520c638a43a5da950393832e.tar.xz
dexon-sol-tools-926fcb296fb728c3520c638a43a5da950393832e.tar.zst
dexon-sol-tools-926fcb296fb728c3520c638a43a5da950393832e.zip
fix(instant): treat executeBuyQuote errors as signature denials
-rw-r--r--packages/instant/src/components/buy_button.tsx14
1 files changed, 9 insertions, 5 deletions
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<BuyButtonProps> {
});
} 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;