From 903b58cc68e2b4990d34d3b696ad52863a318257 Mon Sep 17 00:00:00 2001 From: Pontus Abrahamsson Date: Sun, 22 Dec 2024 18:38:25 +0100 Subject: [PATCH] Delivery type --- .../jobs/tasks/invoice/email/send-email.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/dashboard/jobs/tasks/invoice/email/send-email.tsx b/apps/dashboard/jobs/tasks/invoice/email/send-email.tsx index c0558916af..38e697e431 100644 --- a/apps/dashboard/jobs/tasks/invoice/email/send-email.tsx +++ b/apps/dashboard/jobs/tasks/invoice/email/send-email.tsx @@ -56,10 +56,16 @@ export const sendInvoiceEmail = schemaTask({ ), }); - logger.info("Invoice email sent", { - invoiceId, - response, - }); + if (response.error) { + logger.error("Invoice email failed to send", { + invoiceId, + error: response.error, + }); + + throw new Error("Invoice email failed to send"); + } + + logger.info("Invoice email sent"); await supabase .from("invoices")