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,10 +2,14 @@ import { sendPayment } from '@breeztech/react-native-breez-sdk'
const exampleSendLightningPayment = async () => {
// ANCHOR: send-payment
const bolt11 = 'bolt11 invoice'
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
const amountMsat = 3000000
const response = await sendPayment({ bolt11, amountMsat })
try {
const bolt11 = 'bolt11 invoice'
// The `amountMsat` param is optional and should only passed if the bolt11 doesn't specify an amount.
// The amountMsat is required in case an amount is not specified in the bolt11 invoice'.
const amountMsat = 3000000
const response = await sendPayment({ bolt11, amountMsat })
} catch (err) {
console.error(err)
}
// ANCHOR_END: send-payment
}