diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-21 05:18:47 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-11-21 05:18:47 +0800 |
commit | 934570d12fae9c67ae18fc914577f02a51af3bca (patch) | |
tree | f2d30a259d529338f22aa647f27dc55c2cee3c43 /packages/instant/src/util | |
parent | 748e3c0c5358b99f15baf4bf95da027c9b83eb89 (diff) | |
download | dexon-sol-tools-934570d12fae9c67ae18fc914577f02a51af3bca.tar.gz dexon-sol-tools-934570d12fae9c67ae18fc914577f02a51af3bca.tar.zst dexon-sol-tools-934570d12fae9c67ae18fc914577f02a51af3bca.zip |
Explicit error reporting
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r-- | packages/instant/src/util/buy_quote_updater.ts | 4 | ||||
-rw-r--r-- | packages/instant/src/util/gas_price_estimator.ts | 5 | ||||
-rw-r--r-- | packages/instant/src/util/heap.ts | 3 |
3 files changed, 9 insertions, 3 deletions
diff --git a/packages/instant/src/util/buy_quote_updater.ts b/packages/instant/src/util/buy_quote_updater.ts index 2fd16d781..6cb5e41b6 100644 --- a/packages/instant/src/util/buy_quote_updater.ts +++ b/packages/instant/src/util/buy_quote_updater.ts @@ -9,6 +9,7 @@ import { Action, actions } from '../redux/actions'; import { AffiliateInfo, ERC20Asset } from '../types'; import { assetUtils } from '../util/asset'; import { errorFlasher } from '../util/error_flasher'; +import { errorReporter } from '../util/error_reporter'; export const buyQuoteUpdater = { updateBuyQuoteAsync: async ( @@ -49,8 +50,9 @@ export const buyQuoteUpdater = { } else { throw error; } + } else { + errorReporter.report(error); } - // TODO: report to error reporter on else return; } diff --git a/packages/instant/src/util/gas_price_estimator.ts b/packages/instant/src/util/gas_price_estimator.ts index 6b15809a3..332c8d00a 100644 --- a/packages/instant/src/util/gas_price_estimator.ts +++ b/packages/instant/src/util/gas_price_estimator.ts @@ -7,6 +7,8 @@ import { GWEI_IN_WEI, } from '../constants'; +import { errorReporter } from './error_reporter'; + interface EthGasStationResult { average: number; fastestWait: number; @@ -42,8 +44,9 @@ export class GasPriceEstimator { let fetchedAmount: GasInfo | undefined; try { fetchedAmount = await fetchFastAmountInWeiAsync(); - } catch { + } catch (e) { fetchedAmount = undefined; + errorReporter.report(e); } if (fetchedAmount) { diff --git a/packages/instant/src/util/heap.ts b/packages/instant/src/util/heap.ts index 78ec3b3cc..10670b278 100644 --- a/packages/instant/src/util/heap.ts +++ b/packages/instant/src/util/heap.ts @@ -5,6 +5,7 @@ import * as _ from 'lodash'; import { HEAP_ANALYTICS_ID } from '../constants'; import { AnalyticsEventOptions, AnalyticsUserOptions } from './analytics'; +import { errorReporter } from './error_reporter'; export interface HeapAnalytics { loaded: boolean; @@ -105,8 +106,8 @@ export const heapUtil = { heapFunctionCall(curHeap); } catch (e) { // We never want analytics to crash our React component - // TODO(sk): error reporter here logUtils.log('Analytics error', e); + errorReporter.report(e); } } }, |