diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-05 08:10:56 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2018-12-05 08:10:56 +0800 |
commit | a138ee7e836a2ddb7a2ae317fe56dddaca5703ff (patch) | |
tree | 17193e4600609bc7b5d48dec815fc5be790146e0 /packages/instant | |
parent | 1cc043d7a9d2c7bbdfc6b692ca30b8af8d6b8606 (diff) | |
download | dexon-sol-tools-a138ee7e836a2ddb7a2ae317fe56dddaca5703ff.tar dexon-sol-tools-a138ee7e836a2ddb7a2ae317fe56dddaca5703ff.tar.gz dexon-sol-tools-a138ee7e836a2ddb7a2ae317fe56dddaca5703ff.tar.bz2 dexon-sol-tools-a138ee7e836a2ddb7a2ae317fe56dddaca5703ff.tar.lz dexon-sol-tools-a138ee7e836a2ddb7a2ae317fe56dddaca5703ff.tar.xz dexon-sol-tools-a138ee7e836a2ddb7a2ae317fe56dddaca5703ff.tar.zst dexon-sol-tools-a138ee7e836a2ddb7a2ae317fe56dddaca5703ff.zip |
Add GIT_SHA and NPM_VERSION constants, report git and npm version in error
Diffstat (limited to 'packages/instant')
-rw-r--r-- | packages/instant/src/components/scaling_amount_input.tsx | 4 | ||||
-rw-r--r-- | packages/instant/src/constants.ts | 5 | ||||
-rw-r--r-- | packages/instant/src/util/analytics.ts | 6 | ||||
-rw-r--r-- | packages/instant/src/util/error_reporter.ts | 4 |
4 files changed, 11 insertions, 8 deletions
diff --git a/packages/instant/src/components/scaling_amount_input.tsx b/packages/instant/src/components/scaling_amount_input.tsx index f95020461..86aca5a65 100644 --- a/packages/instant/src/components/scaling_amount_input.tsx +++ b/packages/instant/src/components/scaling_amount_input.tsx @@ -4,7 +4,7 @@ import * as React from 'react'; import { Maybe } from '../types'; -import { MAGIC_TRIGGER_ERROR_INPUT } from '../constants'; +import { GIT_SHA, MAGIC_TRIGGER_ERROR_INPUT, MAGIC_TRIGGER_ERROR_MESSAGE, NPM_PACKAGE_VERSION } from '../constants'; import { ColorOption } from '../style/theme'; import { maybeBigNumberUtil } from '../util/maybe_big_number'; import { util } from '../util/util'; @@ -73,7 +73,7 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps, } private readonly _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => { if (event.target.value === MAGIC_TRIGGER_ERROR_INPUT) { - throw new Error('Triggered error'); + throw new Error(`${MAGIC_TRIGGER_ERROR_MESSAGE} git: ${GIT_SHA}, npm: ${NPM_PACKAGE_VERSION}`); } const sanitizedValue = event.target.value.replace(/[^0-9.]/g, ''); // only allow numbers and "." diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts index bf434e33e..295208b2d 100644 --- a/packages/instant/src/constants.ts +++ b/packages/instant/src/constants.ts @@ -13,11 +13,14 @@ export const WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX = 'Transaction fa export const GWEI_IN_WEI = new BigNumber(1000000000); export const ONE_SECOND_MS = 1000; export const ONE_MINUTE_MS = ONE_SECOND_MS * 60; +export const GIT_SHA = process.env.GIT_SHA; +export const NPM_PACKAGE_VERSION = process.env.NPM_PACKAGE_VERSION; export const ACCOUNT_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 5; export const BUY_QUOTE_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 15; export const DEFAULT_GAS_PRICE = GWEI_IN_WEI.mul(6); export const DEFAULT_ESTIMATED_TRANSACTION_TIME_MS = ONE_MINUTE_MS * 2; -export const MAGIC_TRIGGER_ERROR_INPUT = '0`'; +export const MAGIC_TRIGGER_ERROR_INPUT = '0€'; +export const MAGIC_TRIGGER_ERROR_MESSAGE = 'Triggered error'; export const ETH_GAS_STATION_API_BASE_URL = 'https://ethgasstation.info'; export const HEAP_ANALYTICS_ID = process.env.HEAP_ANALYTICS_ID; export const HEAP_ENABLED = process.env.HEAP_ENABLED; diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts index 760ec8b5c..b7cbfa82a 100644 --- a/packages/instant/src/util/analytics.ts +++ b/packages/instant/src/util/analytics.ts @@ -2,7 +2,7 @@ import { BuyQuote } from '@0x/asset-buyer'; import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; -import { HEAP_ENABLED, INSTANT_DISCHARGE_TARGET } from '../constants'; +import { GIT_SHA, HEAP_ENABLED, INSTANT_DISCHARGE_TARGET, NPM_PACKAGE_VERSION } from '../constants'; import { AffiliateInfo, Asset, @@ -145,8 +145,8 @@ export const analytics = { embeddedUrl: window.location.href, networkId: network, providerName: providerState.name, - gitSha: process.env.GIT_SHA, - npmVersion: process.env.NPM_PACKAGE_VERSION, + gitSha: GIT_SHA, + npmVersion: NPM_PACKAGE_VERSION, orderSource: orderSourceName, affiliateAddress, affiliateFeePercent, diff --git a/packages/instant/src/util/error_reporter.ts b/packages/instant/src/util/error_reporter.ts index 3ec7b6daa..b1824eaf9 100644 --- a/packages/instant/src/util/error_reporter.ts +++ b/packages/instant/src/util/error_reporter.ts @@ -1,7 +1,7 @@ import { logUtils } from '@0x/utils'; import * as _ from 'lodash'; -import { HOST_DOMAINS, INSTANT_DISCHARGE_TARGET, ROLLBAR_CLIENT_TOKEN, ROLLBAR_ENABLED } from '../constants'; +import { GIT_SHA, HOST_DOMAINS, INSTANT_DISCHARGE_TARGET, ROLLBAR_CLIENT_TOKEN, ROLLBAR_ENABLED } from '../constants'; // Import version of Rollbar designed for embedded components // See https://docs.rollbar.com/docs/using-rollbarjs-inside-an-embedded-component @@ -24,7 +24,7 @@ export const setupRollbar = (): any => { client: { javascript: { source_map_enabled: true, - code_version: process.env.GIT_SHA, + code_version: GIT_SHA, guess_uncaught_frames: true, }, }, |