fix: sending mail jobs

This commit is contained in:
Ahmed Bouhuolia
2025-12-05 00:07:26 +02:00
parent 32d74b0413
commit c3dc26a1e4
11 changed files with 100 additions and 31 deletions

View File

@@ -33,7 +33,7 @@ export class SendSaleInvoiceMail {
private readonly tenancyContect: TenancyContext,
@InjectQueue(SendSaleInvoiceQueue) private readonly sendInvoiceQueue: Queue,
) {}
) { }
/**
* Sends the invoice mail of the given sale invoice.
@@ -132,7 +132,13 @@ export class SendSaleInvoiceMail {
events.saleInvoice.onMailSend,
eventPayload,
);
await this.mailTransporter.send(mail);
try {
await this.mailTransporter.send(mail);
} catch (error) {
console.error('Failed to send invoice mail:', error);
throw error;
}
// Triggers the event `onSaleInvoiceSend`.
await this.eventEmitter.emitAsync(