-
-
+const GlobalError = ({ error, clearError }) => {
+ console.log('error: ', error)
+ return (
+
-
-)
+ )
+}
GlobalError.propTypes = {
diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js
index 2b51fa71..609db7c0 100644
--- a/app/lnd/methods/index.js
+++ b/app/lnd/methods/index.js
@@ -112,7 +112,10 @@ export default function (lnd, event, msg, data) {
// { paymentRequest } = data
paymentsController.sendPaymentSync(lnd, data)
.then(({ payment_route }) => event.sender.send('paymentSuccessful', Object.assign(data, { payment_route })))
- .catch(error => console.log('payinvoice error: ', error))
+ .catch(error => {
+ console.log('payinvoice error: ', error)
+ event.sender.send('paymentFailed', { error: error.toString() })
+ })
break
case 'sendCoins':
// Transaction looks like { txid: String }
diff --git a/app/reducers/ipc.js b/app/reducers/ipc.js
index a0789e30..544d6820 100644
--- a/app/reducers/ipc.js
+++ b/app/reducers/ipc.js
@@ -21,7 +21,7 @@ import {
} from './channels'
import { lightningPaymentUri } from './payform'
-import { receivePayments, paymentSuccessful } from './payment'
+import { receivePayments, paymentSuccessful, paymentFailed } from './payment'
import { receiveInvoices, createdInvoice, receiveFormInvoice, invoiceUpdate } from './invoice'
import { receiveBalance } from './balance'
import {
@@ -55,6 +55,7 @@ const ipc = createIpc({
lightningPaymentUri,
paymentSuccessful,
+ paymentFailed,
channelSuccessful,
pushchannelupdated,
diff --git a/app/reducers/payment.js b/app/reducers/payment.js
index 795e88ea..0ef8024d 100644
--- a/app/reducers/payment.js
+++ b/app/reducers/payment.js
@@ -4,6 +4,7 @@ import { fetchBalance } from './balance'
import { setFormType } from './form'
import { resetPayForm } from './payform'
import { showModal } from './modal'
+import { setError } from './error'
// ------------------------------------
// Constants
@@ -47,12 +48,6 @@ export function paymentSuccessfull(payment) {
}
}
-export function paymentFailed() {
- return {
- type: PAYMENT_FAILED
- }
-}
-
// Send IPC event for payments
export const fetchPayments = () => (dispatch) => {
dispatch(getPayments())
@@ -87,6 +82,12 @@ export const paymentSuccessful = () => (dispatch) => {
dispatch(fetchBalance())
}
+export const paymentFailed = (event, { error }) => (dispatch) => {
+ dispatch({ type: PAYMENT_FAILED })
+ console.log('error: ', error)
+ dispatch(setError(error))
+}
+
// ------------------------------------
// Action Handlers
diff --git a/app/reducers/transaction.js b/app/reducers/transaction.js
index 62b446e4..2d007e9c 100644
--- a/app/reducers/transaction.js
+++ b/app/reducers/transaction.js
@@ -70,6 +70,7 @@ 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))
}
diff --git a/app/routes/app/containers/AppContainer.js b/app/routes/app/containers/AppContainer.js
index 66ffa42a..3b86d34b 100644
--- a/app/routes/app/containers/AppContainer.js
+++ b/app/routes/app/containers/AppContainer.js
@@ -49,15 +49,9 @@ const mapDispatchToProps = {
createInvoice,
fetchInvoice,
-<<<<<<< HEAD
-<<<<<<< HEAD
- fetchBlockHeight
-=======
+ fetchBlockHeight,
+ clearError,
clearError
->>>>>>> feature(globalerror): clear error
-=======
- clearError
->>>>>>> 46b03abc5a79d74487165abf8656e69da020f3bc
}
const mapStateToProps = state => ({