mirror of
https://github.com/aljazceru/breez-sdk-docs.git
synced 2025-12-17 13:54:20 +01:00
Wrap promises with try blocks
This commit is contained in:
@@ -2,17 +2,25 @@ import { serviceHealthCheck, reportIssue, ReportIssueRequestVariant } from '@bre
|
||||
|
||||
const healthCheckStatus = async () => {
|
||||
// ANCHOR: health-check-status
|
||||
const healthCheck = await serviceHealthCheck()
|
||||
console.log(`Current service status is: ${healthCheck.status}`)
|
||||
try {
|
||||
const healthCheck = await serviceHealthCheck()
|
||||
console.log(`Current service status is: ${healthCheck.status}`)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
// ANCHOR_END: health-check-status
|
||||
}
|
||||
|
||||
const reportPaymentFailure = async () => {
|
||||
// ANCHOR: report-payment-failure
|
||||
const paymentHash = '...'
|
||||
await reportIssue({
|
||||
type: ReportIssueRequestVariant.PAYMENT_FAILURE,
|
||||
data: { paymentHash }
|
||||
})
|
||||
try {
|
||||
const paymentHash = '...'
|
||||
await reportIssue({
|
||||
type: ReportIssueRequestVariant.PAYMENT_FAILURE,
|
||||
data: { paymentHash }
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
// ANCHOR_END: report-payment-failure
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user