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

@@ -5,16 +5,24 @@ import {
const exampleListPayments = async () => {
// ANCHOR: list-payments
const payments = listPayments({})
try {
const payments = await listPayments({})
} catch (err) {
console.error(err)
}
// ANCHOR_END: list-payments
}
const exampleListPaymentsFiltered = async () => {
// ANCHOR: list-payments-filtered
const payments = listPayments({
filters: [PaymentTypeFilter.SENT],
fromTimestamp: 1696880000,
includeFailures: true
})
try {
const payments = await listPayments({
filters: [PaymentTypeFilter.SENT],
fromTimestamp: 1696880000,
includeFailures: true
})
} catch (err) {
console.error(err)
}
// ANCHOR_END: list-payments-filtered
}