diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js index 609db7c0..193ed793 100644 --- a/app/lnd/methods/index.js +++ b/app/lnd/methods/index.js @@ -155,7 +155,10 @@ export default function (lnd, event, msg, data) { console.log('peer_id: ', peer_id) event.sender.send('connectSuccess', { pub_key: data.pubkey, address: data.host, peer_id }) }) - .catch(error => console.log('connectPeer error: ', error)) + .catch(error => { + event.sender.send('connectFailure', { error: error.toString() }) + console.log('connectPeer error: ', error) + }) break case 'disconnectPeer': // Empty response. Pass back pubkey on success to remove it from the peers list diff --git a/app/reducers/ipc.js b/app/reducers/ipc.js index 544d6820..f2cea7a7 100644 --- a/app/reducers/ipc.js +++ b/app/reducers/ipc.js @@ -3,7 +3,7 @@ import { lndSyncing, lndSynced, lndStdout } from './lnd' import { receiveInfo } from './info' import { receiveAddress } from './address' import { receiveCryptocurrency } from './ticker' -import { receivePeers, connectSuccess, disconnectSuccess } from './peers' +import { receivePeers, connectSuccess, disconnectSuccess, connectFailure } from './peers' import { receiveChannels, @@ -69,6 +69,7 @@ const ipc = createIpc({ pushclosechannelstatus, connectSuccess, + connectFailure, disconnectSuccess, receiveAddress, diff --git a/app/reducers/payment.js b/app/reducers/payment.js index 0ef8024d..a3907ca7 100644 --- a/app/reducers/payment.js +++ b/app/reducers/payment.js @@ -84,7 +84,6 @@ export const paymentSuccessful = () => (dispatch) => { export const paymentFailed = (event, { error }) => (dispatch) => { dispatch({ type: PAYMENT_FAILED }) - console.log('error: ', error) dispatch(setError(error)) } diff --git a/app/reducers/peers.js b/app/reducers/peers.js index e6aec70e..5b7060f7 100644 --- a/app/reducers/peers.js +++ b/app/reducers/peers.js @@ -1,5 +1,6 @@ import { createSelector } from 'reselect' import { ipcRenderer } from 'electron' +import { setError } from './error' // ------------------------------------ // Constants // ------------------------------------ @@ -27,12 +28,6 @@ export function connectPeer() { } } -export function connectFailure() { - return { - type: CONNECT_FAILURE - } -} - export function disconnectPeer() { return { type: DISCONNECT_PEER @@ -83,6 +78,12 @@ export const connectRequest = ({ pubkey, host }) => (dispatch) => { // Send IPC receive for successfully connecting to a peer export const connectSuccess = (event, peer) => dispatch => dispatch({ type: CONNECT_SUCCESS, peer }) +// Send IPC receive for unsuccessfully connecting to a peer +export const connectFailure = (event, { error }) => dispatch => { + dispatch({ type: CONNECT_FAILURE }) + dispatch(setError(error)) +} + // Send IPC send for disconnecting from a peer export const disconnectRequest = ({ pubkey }) => (dispatch) => { dispatch(disconnectPeer()) diff --git a/app/reducers/transaction.js b/app/reducers/transaction.js index 2d007e9c..62b446e4 100644 --- a/app/reducers/transaction.js +++ b/app/reducers/transaction.js @@ -70,7 +70,6 @@ export const transactionSuccessful = (event, { amount, addr, txid }) => (dispatc export const transactionError = (event, { error }) => (dispatch) => { dispatch({ type: TRANSACTION_FAILED }) - console.log('error: ', error) dispatch(setError(error)) }