Skip to content

Commit

Permalink
Add sentry warnings for email tasks when email template is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
ranta committed May 21, 2024
1 parent fd8e8b8 commit 5b36451
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions email_notification/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from spaces.models import Unit
from tilavarauspalvelu.celery import app
from users.models import ReservationNotification, User
from utils.sentry import SentryLogger

###############
# Reservation #
Expand Down Expand Up @@ -110,6 +111,8 @@ def send_application_in_allocation_email_task() -> None:
try:
email_sender = EmailNotificationSender(email_type=EmailType.APPLICATION_IN_ALLOCATION, recipients=None)
except SendEmailNotificationError:
msg = "Tried to send an email, but Email Template for APPLICATION_IN_ALLOCATION was not found."
SentryLogger.log_message(msg, level="warning")
return

# Get all applications that need a notification to be sent
Expand All @@ -135,6 +138,8 @@ def send_application_handled_email_task() -> None:
try:
email_sender = EmailNotificationSender(email_type=EmailType.APPLICATION_HANDLED, recipients=None)
except SendEmailNotificationError:
msg = "Tried to send an email, but Email Template for APPLICATION_HANDLED was not found."
SentryLogger.log_message(msg, level="warning")
return

# Get all applications that need a notification to be sent
Expand Down

0 comments on commit 5b36451

Please sign in to comment.