diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-06 22:26:04 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-06-06 22:26:04 +0800 |
commit | cf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78 (patch) | |
tree | 1ab6a8d6b8588707286fc56a632dca9ceca7e7ac /packages/website/ts | |
parent | af1d5fce6ea355b12bf5f63f51ea81ff596f7868 (diff) | |
download | dexon-sol-tools-cf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78.tar dexon-sol-tools-cf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78.tar.gz dexon-sol-tools-cf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78.tar.bz2 dexon-sol-tools-cf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78.tar.lz dexon-sol-tools-cf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78.tar.xz dexon-sol-tools-cf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78.tar.zst dexon-sol-tools-cf8fdd3a701f21bfc3b2ec8397fa65948f5cdc78.zip |
Move spawnSwitchErr to @0xproject/utils
Diffstat (limited to 'packages/website/ts')
4 files changed, 6 insertions, 8 deletions
diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index 2bc065b0f..ed12cd85a 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -6,7 +6,7 @@ import { Styles, utils as sharedUtils, } from '@0xproject/react-shared'; -import { BigNumber, logUtils } from '@0xproject/utils'; +import { BigNumber, errorUtils, logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; @@ -499,7 +499,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala return null; // No error to show default: - throw utils.spawnSwitchErr('errorType', this.state.errorType); + throw errorUtils.spawnSwitchErr('errorType', this.state.errorType); } } private _onErrorOccurred(errorType: BalanceErrs): void { diff --git a/packages/website/ts/components/ui/lifecycle_raised_button.tsx b/packages/website/ts/components/ui/lifecycle_raised_button.tsx index b06978f16..afb09a4bb 100644 --- a/packages/website/ts/components/ui/lifecycle_raised_button.tsx +++ b/packages/website/ts/components/ui/lifecycle_raised_button.tsx @@ -1,4 +1,5 @@ import { colors } from '@0xproject/react-shared'; +import { errorUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; @@ -63,7 +64,7 @@ export class LifeCycleRaisedButton extends React.Component<LifeCycleRaisedButton label = this.props.labelComplete; break; default: - throw utils.spawnSwitchErr('ButtonState', this.state.buttonState); + throw errorUtils.spawnSwitchErr('ButtonState', this.state.buttonState); } return ( <RaisedButton diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 37233930e..5ad7602a6 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -4,7 +4,7 @@ import { Styles, utils as sharedUtils, } from '@0xproject/react-shared'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, errorUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as _ from 'lodash'; import CircularProgress from 'material-ui/CircularProgress'; @@ -500,7 +500,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { buttonIconName = 'zmdi-long-arrow-up'; break; default: - throw utils.spawnSwitchErr('wrappedEtherDirection', wrappedEtherDirection); + throw errorUtils.spawnSwitchErr('wrappedEtherDirection', wrappedEtherDirection); } } const onClick = isWrappedEtherDirectionOpen diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index b9d962b75..a802e16d7 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -33,9 +33,6 @@ export const utils = { throw new Error(message); } }, - spawnSwitchErr(name: string, value: any): Error { - return new Error(`Unexpected switch value: ${value} encountered for ${name}`); - }, isNumeric(n: string): boolean { return !isNaN(parseFloat(n)) && isFinite(Number(n)); }, |