Wrap promises with try blocks

This commit is contained in:
Ross Savage
2024-02-06 20:25:50 +01:00
parent 0379597d5e
commit aec144693d
17 changed files with 275 additions and 145 deletions

View File

@@ -2,11 +2,15 @@ import { receivePayment } from '@breeztech/react-native-breez-sdk'
const exampleReceiveLightningPayment = async () => {
// ANCHOR: receive-payment
const receivePaymentResponse = await receivePayment({
amountMsat: 3_000_000,
description: 'Invoice for 3000 sats'
})
try {
const receivePaymentResponse = await receivePayment({
amountMsat: 3_000_000,
description: 'Invoice for 3000 sats'
})
const invoice = receivePaymentResponse.lnInvoice
const invoice = receivePaymentResponse.lnInvoice
} catch (err) {
console.error(err)
}
// ANCHOR_END: receive-payment
}