diff --git a/src/components/modals/Send/index.js b/src/components/modals/Send/index.js index 2f4bbafe..e78eaecf 100644 --- a/src/components/modals/Send/index.js +++ b/src/components/modals/Send/index.js @@ -44,6 +44,7 @@ type Props = { type State = { stepId: string, + openedFromAccount: boolean, account: ?Account, bridge: ?WalletBridge, transaction: ?Transaction, @@ -54,6 +55,7 @@ type State = { } export type StepProps = DefaultStepProps & { + openedFromAccount: boolean, device: ?Device, account: ?Account, bridge: ?WalletBridge, @@ -118,6 +120,7 @@ const mapDispatchToProps = { const INITIAL_STATE = { stepId: 'amount', amount: 0, + openedFromAccount: false, account: null, bridge: null, transaction: null, @@ -151,7 +154,12 @@ class SendModal extends PureComponent> { const account = (data && data.account) || accounts[0] const bridge = account ? getBridgeForCurrency(account.currency) : null const transaction = bridge ? bridge.createTransaction(account) : null - this.setState({ account, bridge, transaction }) + this.setState({ + openedFromAccount: !!(data && data.account), + account, + bridge, + transaction, + }) } } @@ -227,6 +235,7 @@ class SendModal extends PureComponent> { const { t, device, openModal } = this.props const { stepId, + openedFromAccount, account, isAppOpened, bridge, @@ -237,6 +246,7 @@ class SendModal extends PureComponent> { const addtionnalProps = { device, + openedFromAccount, account, bridge, transaction, diff --git a/src/components/modals/Send/steps/01-step-amount.js b/src/components/modals/Send/steps/01-step-amount.js index 0e2524d0..3461a4d7 100644 --- a/src/components/modals/Send/steps/01-step-amount.js +++ b/src/components/modals/Send/steps/01-step-amount.js @@ -20,6 +20,7 @@ export default ({ t, account, bridge, + openedFromAccount, transaction, onChangeAccount, onChangeTransaction, @@ -35,14 +36,14 @@ export default ({ - + {account && bridge && transaction && ( { + process.send({ + type: 'uncaughtException', + error: serializeError(err), + }) + process.exit(1) +}) const defers = {} @@ -107,4 +115,8 @@ process.on('message', m => { } }) +process.on('disconnect', () => { + process.exit(0) +}) + logger.log('Internal process is up!') diff --git a/src/main/bridge.js b/src/main/bridge.js index 88cfd4f3..4cf7d9b4 100644 --- a/src/main/bridge.js +++ b/src/main/bridge.js @@ -7,9 +7,10 @@ import { ipcMain, app } from 'electron' import { ipcMainListenReceiveCommands } from 'helpers/ipc' import path from 'path' import logger from 'logger' -import sentry from 'sentry/node' +import sentry, { captureException } from 'sentry/node' import user from 'helpers/user' import resolveLogsDirectory from 'helpers/resolveLogsDirectory' +import { deserializeError } from 'helpers/errors' import setupAutoUpdater, { quitAndInstall } from './autoUpdate' import { setInternalProcessPID } from './terminator' @@ -105,6 +106,11 @@ ipcMainListenReceiveCommands({ function handleGlobalInternalMessage(payload) { switch (payload.type) { + case 'uncaughtException': { + const err = deserializeError(payload.error) + captureException(err) + break + } case 'setLibcoreBusy': case 'setDeviceBusy': case 'executeHttpQueryOnRenderer': {