diff options
author | Brandon Millman <brandon@0xproject.com> | 2018-12-21 07:35:26 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-21 07:35:26 +0800 |
commit | 9b540fd8e52e7578d3749e6d9ef9cd97d602ffb3 (patch) | |
tree | 87b38e76cc52301a4b4fd259c83f3eb69414fe85 /packages/instant/src/components/buy_button.tsx | |
parent | 5ec1ae5f7f488d20130d68ed422fac769b843f93 (diff) | |
parent | 56af9b2aab26fd6a774d0b345ce8e1441bb1a9e0 (diff) | |
download | dexon-0x-contracts-9b540fd8e52e7578d3749e6d9ef9cd97d602ffb3.tar.gz dexon-0x-contracts-9b540fd8e52e7578d3749e6d9ef9cd97d602ffb3.tar.zst dexon-0x-contracts-9b540fd8e52e7578d3749e6d9ef9cd97d602ffb3.zip |
Merge pull request #1434 from 0xProject/fix/instant/signature-denied
[instant] fix signature denial error message and add trust wallet detection
Diffstat (limited to 'packages/instant/src/components/buy_button.tsx')
-rw-r--r-- | packages/instant/src/components/buy_button.tsx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx index 1489b94d4..5c9c28ae4 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,13 +83,18 @@ export class BuyButton extends React.Component<BuyButtonProps> { }); } catch (e) { if (e instanceof Error) { - if (e.message === AssetBuyerError.SignatureRequestDenied) { + if (e.message === AssetBuyerError.TransactionValueTooLow) { + analytics.trackBuySimulationFailed(buyQuote); + this.props.onValidationFail(buyQuote, AssetBuyerError.TransactionValueTooLow); + return; + } else if (e.message === AssetBuyerError.SignatureRequestDenied) { analytics.trackBuySignatureDenied(buyQuote); this.props.onSignatureDenied(buyQuote); return; - } else if (e.message === AssetBuyerError.TransactionValueTooLow) { - analytics.trackBuySimulationFailed(buyQuote); - this.props.onValidationFail(buyQuote, AssetBuyerError.TransactionValueTooLow); + } else { + errorReporter.report(e); + analytics.trackBuyUnknownError(buyQuote, e.message); + this.props.onValidationFail(buyQuote, ZeroExInstantError.CouldNotSubmitTransaction); return; } } |