Browse Source

Merge pull request #1775 from gre/LL-927

Use logger.critical(error) at more important places
gre-patch-1
Gaëtan Renaudeau 6 years ago
committed by GitHub
parent
commit
25ae88591c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/bridge/BridgeSyncContext.js
  2. 2
      src/components/SelectExchange.js
  3. 2
      src/components/SettingsPage/RepairDeviceButton.js
  4. 4
      src/components/modals/AddAccounts/index.js
  5. 4
      src/components/modals/Receive/index.js
  6. 4
      src/components/modals/Send/index.js
  7. 6
      src/components/modals/UpdateFirmware/index.js

1
src/bridge/BridgeSyncContext.js

@ -100,6 +100,7 @@ class Provider extends Component<BridgeSyncProviderOwnProps, Sync> {
next()
},
error: error => {
logger.critical(error)
this.props.setAccountSyncState(accountId, { pending: false, error })
next()
},

2
src/components/SelectExchange.js

@ -87,7 +87,7 @@ class SelectExchange extends Component<
this.setState({ exchanges, isLoading: false })
}
} catch (error) {
logger.error(error)
logger.critical(error)
if (!this._unmounted && this._loadId === _loadId) {
this.setState({ error, isLoading: false })
}

2
src/components/SettingsPage/RepairDeviceButton.js

@ -6,6 +6,7 @@ import { connect } from 'react-redux'
import { withRouter } from 'react-router'
import { translate } from 'react-i18next'
import { push } from 'react-router-redux'
import logger from 'logger'
import type { T } from 'types/common'
import firmwareRepair from 'commands/firmwareRepair'
@ -50,6 +51,7 @@ class RepairDeviceButton extends PureComponent<Props, State> {
this.setState(patch)
},
error: error => {
logger.critical(error)
this.setState({ error, isLoading: false, progress: 0 })
},
complete: () => {

4
src/components/modals/AddAccounts/index.js

@ -24,6 +24,7 @@ import { closeModal } from 'reducers/modals'
import Modal from 'components/base/Modal'
import Stepper from 'components/base/Stepper'
import { validateNameEdition } from '@ledgerhq/live-common/lib/account'
import logger from 'logger'
import StepChooseCurrency, { StepChooseCurrencyFooter } from './steps/01-step-choose-currency'
import StepConnectDevice, { StepConnectDeviceFooter } from './steps/02-step-connect-device'
@ -165,6 +166,9 @@ class AddAccounts extends PureComponent<Props, State> {
handleSetCurrency = (currency: ?Currency) => this.setState({ currency })
handleSetScanStatus = (scanStatus: string, err: ?Error = null) => {
if (err) {
logger.critical(err)
}
this.setState({ scanStatus, err })
}

4
src/components/modals/Receive/index.js

@ -8,6 +8,7 @@ import { createStructuredSelector } from 'reselect'
import SyncSkipUnderPriority from 'components/SyncSkipUnderPriority'
import logger from 'logger'
import Track from 'analytics/Track'
import type { Account } from '@ledgerhq/live-common/lib/types'
@ -141,6 +142,9 @@ class ReceiveModal extends PureComponent<Props, State> {
handleChangeAppOpened = (isAppOpened: boolean) => this.setState({ isAppOpened })
handleChangeAddressVerified = (isAddressVerified: boolean, err: ?Error) => {
if (err && err.name !== 'UserRefusedAddress') {
logger.critical(err)
}
this.setState({ isAddressVerified, verifyAddressError: err })
}

4
src/components/modals/Send/index.js

@ -12,6 +12,7 @@ import Track from 'analytics/Track'
import { updateAccountWithUpdater } from 'actions/accounts'
import { MODAL_SEND } from 'config/constants'
import { getBridgeForCurrency } from 'bridge'
import logger from 'logger'
import type { WalletBridge } from 'bridge/types'
import type { T, Device } from 'types/common'
@ -180,6 +181,9 @@ class SendModal extends PureComponent<Props, State<*>> {
}
handleTransactionError = (error: Error) => {
if (!(error instanceof UserRefusedOnDevice)) {
logger.critical(error)
}
const stepVerificationIndex = this.STEPS.findIndex(step => step.id === 'verification')
if (stepVerificationIndex === -1) return
this.setState({ error })

6
src/components/modals/UpdateFirmware/index.js

@ -11,6 +11,7 @@ import type { FirmwareUpdateContext } from '@ledgerhq/live-common/lib/types/mana
import type { StepProps as DefaultStepProps, Step } from 'components/base/Stepper'
import type { ModalStatus } from 'components/ManagerPage/FirmwareUpdate'
import logger from 'logger'
import { FreezeDeviceChangeEvents } from '../../ManagerPage/HookDeviceChange'
import StepFullFirmwareInstall from './steps/01-step-install-full-firmware'
@ -82,7 +83,10 @@ class UpdateModal extends PureComponent<Props, State> {
t: this.props.t,
})
setError = (e: Error) => this.setState({ error: e })
setError = (e: Error) => {
logger.critical(e)
this.setState({ error: e })
}
handleReset = () => this.setState({ stepId: 'idCheck', error: null, nonce: this.state.nonce++ })

Loading…
Cancel
Save