Skip to content

Commit 78d0407

Browse files
committed
Log email errors and continue
1 parent 94cc0ab commit 78d0407

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

project/velkoja/holvichecker.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
from decimal import Decimal
23
from django.utils import timezone
34
from django.conf import settings
@@ -8,6 +9,8 @@
89
from django.template import Context
910
from django.template.loader import get_template
1011

12+
logger = logger.getLogger()
13+
1114
class HolviOverdueInvoicesHandler(object):
1215
def process_overdue(self, send=False):
1316
barcode_iban = settings.HOLVI_BARCODE_IBAN
@@ -37,7 +40,10 @@ def process_overdue(self, send=False):
3740
mail.body = body_template.render(Context({ "invoice": invoice, "barcode": barcode }))
3841
mail.to = [invoice.receiver.email]
3942
if send:
40-
mail.send()
43+
try:
44+
mail.send()
45+
except Exception as e:
46+
logger.exception("Sending email failed")
4147

4248
try:
4349
notified = NotificationSent.objects.get(transaction_unique_id=invoice.code)

0 commit comments

Comments
 (0)