-
-
-
-
{error}
+const GlobalError = ({ error, clearError }) => (
+
+)
+
GlobalError.propTypes = {
diff --git a/app/lnd/methods/index.js b/app/lnd/methods/index.js
index 193ed793..0d0dd348 100644
--- a/app/lnd/methods/index.js
+++ b/app/lnd/methods/index.js
@@ -105,7 +105,10 @@ export default function (lnd, event, msg, data) {
})
)
)
- .catch(error => console.log('addInvoice error: ', error))
+ .catch(error => {
+ console.log('addInvoice error: ', error)
+ event.sender.send('invoiceFailed', { error: error.toString() })
+ })
break
case 'sendPayment':
// Payment looks like { payment_preimage: Buffer, payment_route: Object }
diff --git a/app/reducers/invoice.js b/app/reducers/invoice.js
index e151ccf8..795544c9 100644
--- a/app/reducers/invoice.js
+++ b/app/reducers/invoice.js
@@ -5,6 +5,7 @@ import { fetchBalance } from './balance'
import { setFormType } from './form'
import { setPayInvoice } from './payform'
import { resetRequestForm } from './requestform'
+import { setError } from './error'
import { showNotification } from '../notifications'
import { btc, usd } from '../utils'
@@ -71,12 +72,6 @@ export function sendInvoice() {
}
}
-export function invoiceFailed() {
- return {
- type: INVOICE_FAILED
- }
-}
-
// Send IPC event for a specific invoice
export const fetchInvoice = payreq => (dispatch) => {
dispatch(getInvoice())
@@ -117,6 +112,11 @@ export const createdInvoice = (event, invoice) => (dispatch) => {
dispatch(resetRequestForm())
}
+export const invoiceFailed = (event, { error }) => dispatch => {
+ dispatch({ type: INVOICE_FAILED })
+ dispatch(setError(error))
+}
+
// Listen for invoice updates pushed from backend from subscribeToInvoices
export const invoiceUpdate = (event, { invoice }) => (dispatch) => {
dispatch({ type: UPDATE_INVOICE, invoice })
diff --git a/app/reducers/ipc.js b/app/reducers/ipc.js
index f2cea7a7..0b3f7a8f 100644
--- a/app/reducers/ipc.js
+++ b/app/reducers/ipc.js
@@ -22,7 +22,7 @@ import {
} from './channels'
import { lightningPaymentUri } from './payform'
import { receivePayments, paymentSuccessful, paymentFailed } from './payment'
-import { receiveInvoices, createdInvoice, receiveFormInvoice, invoiceUpdate } from './invoice'
+import { receiveInvoices, createdInvoice, receiveFormInvoice, invoiceUpdate, invoiceFailed } from './invoice'
import { receiveBalance } from './balance'
import {
receiveTransactions,
@@ -48,6 +48,7 @@ const ipc = createIpc({
receiveInvoices,
receiveInvoice: receiveFormInvoice,
createdInvoice,
+ invoiceFailed,
invoiceUpdate,
receiveBalance,