diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-14 09:06:02 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-14 09:13:48 +0800 |
commit | c8a8b851d8e0622559f71843a206a0e6e601cd83 (patch) | |
tree | 143e238a68005fdb0e0d82c6750ea890fec4021c /packages/website/ts/components | |
parent | c2f8858aabad2355e09ba65e900202b7c4edec5e (diff) | |
download | dexon-0x-contracts-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar dexon-0x-contracts-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.gz dexon-0x-contracts-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.bz2 dexon-0x-contracts-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.lz dexon-0x-contracts-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.xz dexon-0x-contracts-c8a8b851d8e0622559f71843a206a0e6e601cd83.tar.zst dexon-0x-contracts-c8a8b851d8e0622559f71843a206a0e6e601cd83.zip |
Consolidate all console.log into the @0xproject/utils package
Diffstat (limited to 'packages/website/ts/components')
9 files changed, 29 insertions, 29 deletions
diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx index 87b75ed95..d7190c0bb 100644 --- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx +++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx @@ -1,6 +1,6 @@ import { ZeroEx } from '0x.js'; import { colors, constants as sharedConstants } from '@0xproject/react-shared'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import FlatButton from 'material-ui/FlatButton'; @@ -239,7 +239,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, addressBalances.push(balanceInWei); } } catch (err) { - utils.consoleLog(`Ledger error: ${JSON.stringify(err)}`); + logUtils.log(`Ledger error: ${JSON.stringify(err)}`); this.setState({ connectionErrMsg: 'Failed to connect. Follow the instructions and try again.', }); @@ -265,7 +265,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps, private async _onConnectLedgerClickAsync() { const isU2FSupported = await utils.isU2FSupportedAsync(); if (!isU2FSupported) { - utils.consoleLog(`U2F not supported in this browser`); + logUtils.log(`U2F not supported in this browser`); this.setState({ connectionErrMsg: 'U2F not supported by this browser. Try using Chrome.', }); diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx index 8e13d0aae..586d260fb 100644 --- a/packages/website/ts/components/eth_weth_conversion_button.tsx +++ b/packages/website/ts/components/eth_weth_conversion_button.tsx @@ -1,5 +1,5 @@ import { ZeroEx } from '0x.js'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; @@ -111,8 +111,8 @@ export class EthWethConversionButton extends React.Component< if (_.includes(errMsg, BlockchainCallErrs.UserHasNoAssociatedAddresses)) { this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen(true); } else if (!utils.didUserDenyWeb3Request(errMsg)) { - utils.consoleLog(`Unexpected error encountered: ${err}`); - utils.consoleLog(err.stack); + logUtils.log(`Unexpected error encountered: ${err}`); + logUtils.log(err.stack); const errorMsg = direction === Side.Deposit ? 'Failed to wrap your ETH. Please try again.' diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index f1eee3e89..a6144bd6b 100644 --- a/packages/website/ts/components/fill_order.tsx +++ b/packages/website/ts/components/fill_order.tsx @@ -1,6 +1,6 @@ import { Order as ZeroExOrder, ZeroEx } from '0x.js'; import { colors, constants as sharedConstants } from '@0xproject/react-shared'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import * as accounting from 'accounting'; import * as _ from 'lodash'; import { Card, CardHeader, CardText } from 'material-ui/Card'; @@ -403,7 +403,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { const validationResult = validator.validate(order, portalOrderSchema); if (validationResult.errors.length > 0) { orderJSONErrMsg = 'Submitted order JSON is not a valid order'; - utils.consoleLog(`Unexpected order JSON validation error: ${validationResult.errors.join(', ')}`); + logUtils.log(`Unexpected order JSON validation error: ${validationResult.errors.join(', ')}`); return; } parsedOrder = order; @@ -448,7 +448,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { this.props.dispatcher.updateUserSuppliedOrderCache(parsedOrder); } } catch (err) { - utils.consoleLog(`Validate order err: ${err}`); + logUtils.log(`Validate order err: ${err}`); if (!_.isEmpty(orderJSON)) { orderJSONErrMsg = 'Submitted order JSON is not valid JSON'; } @@ -564,7 +564,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { return; } globalErrMsg = 'Failed to fill order, please refresh and try again'; - utils.consoleLog(`${err}`); + logUtils.log(`${err}`); this.setState({ globalErrMsg, }); @@ -635,7 +635,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { } analytics.logEvent('Portal', 'Cancel Order Failure', eventLabel, parsedOrder.signedOrder.makerTokenAmount); globalErrMsg = 'Failed to cancel order, please refresh and try again'; - utils.consoleLog(`${err}`); + logUtils.log(`${err}`); this.setState({ globalErrMsg, }); diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx index 559acd1d6..eb76cb529 100644 --- a/packages/website/ts/components/generate_order/generate_order_form.tsx +++ b/packages/website/ts/components/generate_order/generate_order_form.tsx @@ -1,6 +1,6 @@ import { ECSignature, Order, ZeroEx } from '0x.js'; import { colors, constants as sharedConstants } from '@0xproject/react-shared'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; import Divider from 'material-ui/Divider'; @@ -326,7 +326,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G const validationResult = validator.validate(order, portalOrderSchema); if (validationResult.errors.length > 0) { globalErrMsg = 'Order signing failed. Please refresh and try again'; - utils.consoleLog(`Unexpected error occured: Order validation failed: + logUtils.log(`Unexpected error occured: Order validation failed: ${validationResult.errors}`); } } catch (err) { @@ -335,8 +335,8 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G globalErrMsg = 'User denied sign request'; } else { globalErrMsg = 'An unexpected error occured. Please try refreshing the page'; - utils.consoleLog(`Unexpected error occured: ${err}`); - utils.consoleLog(err.stack); + logUtils.log(`Unexpected error occured: ${err}`); + logUtils.log(err.stack); await errorReporter.reportAsync(err); } } diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx index e548bfc82..da6f900e6 100644 --- a/packages/website/ts/components/inputs/allowance_toggle.tsx +++ b/packages/website/ts/components/inputs/allowance_toggle.tsx @@ -1,5 +1,5 @@ import { constants as sharedConstants } from '@0xproject/react-shared'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import Toggle from 'material-ui/Toggle'; import * as React from 'react'; @@ -93,8 +93,8 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow if (utils.didUserDenyWeb3Request(errMsg)) { return; } - utils.consoleLog(`Unexpected error encountered: ${err}`); - utils.consoleLog(err.stack); + logUtils.log(`Unexpected error encountered: ${err}`); + logUtils.log(err.stack); this.props.onErrorOccurred(BalanceErrs.allowanceSettingFailed); await errorReporter.reportAsync(err); } diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx index a5dd9ebc1..02b88b888 100644 --- a/packages/website/ts/components/order_json.tsx +++ b/packages/website/ts/components/order_json.tsx @@ -1,5 +1,5 @@ import { ECSignature } from '0x.js'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import Paper from 'material-ui/Paper'; import TextField from 'material-ui/TextField'; @@ -153,7 +153,7 @@ You can see and fill it here: ${this.state.shareLink}`); const bodyObj = JSON.parse(responseBody); if (response.status !== 200 || bodyObj.status_code !== 200) { // TODO: Show error message in UI - utils.consoleLog(`Unexpected status code: ${response.status} -> ${responseBody}`); + logUtils.log(`Unexpected status code: ${response.status} -> ${responseBody}`); await errorReporter.reportAsync(new Error(`Bitly returned non-200: ${JSON.stringify(response)}`)); return ''; } diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx index 7df340f45..5bdb5bde9 100644 --- a/packages/website/ts/components/portal.tsx +++ b/packages/website/ts/components/portal.tsx @@ -1,5 +1,5 @@ import { colors } from '@0xproject/react-shared'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import CircularProgress from 'material-ui/CircularProgress'; import Paper from 'material-ui/Paper'; @@ -374,7 +374,7 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> { const order = JSON.parse(decodeURIComponent(orderPair[1])); const validationResult = validator.validate(order, portalOrderSchema); if (validationResult.errors.length > 0) { - utils.consoleLog(`Invalid shared order: ${validationResult.errors}`); + logUtils.log(`Invalid shared order: ${validationResult.errors}`); return undefined; } return order; diff --git a/packages/website/ts/components/send_button.tsx b/packages/website/ts/components/send_button.tsx index ffa165f60..79c103e05 100644 --- a/packages/website/ts/components/send_button.tsx +++ b/packages/website/ts/components/send_button.tsx @@ -1,4 +1,4 @@ -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; @@ -77,8 +77,8 @@ export class SendButton extends React.Component<SendButtonProps, SendButtonState this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen(true); return; } else if (!utils.didUserDenyWeb3Request(errMsg)) { - utils.consoleLog(`Unexpected error encountered: ${err}`); - utils.consoleLog(err.stack); + logUtils.log(`Unexpected error encountered: ${err}`); + logUtils.log(err.stack); this.props.onError(); await errorReporter.reportAsync(err); } diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx index 894e0721f..186393c4f 100644 --- a/packages/website/ts/components/token_balances.tsx +++ b/packages/website/ts/components/token_balances.tsx @@ -7,7 +7,7 @@ import { Styles, utils as sharedUtils, } from '@0xproject/react-shared'; -import { BigNumber } from '@0xproject/utils'; +import { BigNumber, logUtils } from '@0xproject/utils'; import DharmaLoanFrame from 'dharma-loan-frame'; import * as _ from 'lodash'; import Dialog from 'material-ui/Dialog'; @@ -591,8 +591,8 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala if (utils.didUserDenyWeb3Request(errMsg)) { return false; } - utils.consoleLog(`Unexpected error encountered: ${err}`); - utils.consoleLog(err.stack); + logUtils.log(`Unexpected error encountered: ${err}`); + logUtils.log(err.stack); this.setState({ errorType: BalanceErrs.mintingFailed, }); @@ -623,7 +623,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala ); const responseBody = await response.text(); if (response.status !== constants.SUCCESS_STATUS) { - utils.consoleLog(`Unexpected status code: ${response.status} -> ${responseBody}`); + logUtils.log(`Unexpected status code: ${response.status} -> ${responseBody}`); const errorType = response.status === constants.UNAVAILABLE_STATUS ? BalanceErrs.faucetQueueIsFull |