Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sigruntg committed Nov 8, 2024
1 parent 8193d16 commit f88c890
Showing 1 changed file with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,19 @@ export class TransferOfMachineOwnershipTemplateService extends BaseTemplateApiSe
auth: User,
applicationId: string,
): Promise<void> {
const deleteChange = {
ownerchangeId: applicationId,
xCorrelationID: applicationId,
try {
const deleteChange = {
ownerchangeId: applicationId,
xCorrelationID: applicationId,
}
await this.workMachineClientService.deleteOwnerChange(auth, deleteChange)
} catch (error) {
this.logger.error(
`Failed to delete owner change for application ${applicationId}`,
error,
)
throw error
}
await this.workMachineClientService.deleteOwnerChange(auth, deleteChange)
}

async deleteApplication({
Expand All @@ -288,8 +296,16 @@ export class TransferOfMachineOwnershipTemplateService extends BaseTemplateApiSe
}: TemplateApiModuleActionProps): Promise<void> {
// 1. Delete charge so that the seller gets reimburshed
const chargeId = getPaymentIdFromExternalData(application)
if (chargeId) {
await this.chargeFjsV2ClientService.deleteCharge(chargeId)
try {
if (chargeId) {
await this.chargeFjsV2ClientService.deleteCharge(chargeId)
}
} catch (error) {
this.logger.error(
`Failed to delete charge ${chargeId} for application ${application.id}`,
error,
)
throw error
}

// 2. Delete owner change in work machines
Expand Down

0 comments on commit f88c890

Please sign in to comment.