Jas list error notification only in prod
This commit is contained in:
+3
-1
@@ -18,6 +18,7 @@ from sendgrid.helpers.mail import (
|
||||
from django.template.loader import render_to_string
|
||||
from django.core.files.base import ContentFile
|
||||
from sikweb.settings import (
|
||||
DEPLOY_ENV,
|
||||
FRONTEND_URL,
|
||||
EMAIL_API_KEY,
|
||||
DEFAULT_EMAIL_FROM,
|
||||
@@ -144,10 +145,11 @@ def add_to_mailinglist(email: str):
|
||||
# Already in list, do nothing
|
||||
if err.status_code == 409:
|
||||
pass
|
||||
# Something went wrong, send notification to maintainer.
|
||||
else:
|
||||
logging.exception("Failed adding user to list")
|
||||
|
||||
# Send email notificcation to maintainer, only in prod
|
||||
if DEPLOY_ENV == "production":
|
||||
to = "ilari.ojakorpi@sahkoinsinoorikilta.fi"
|
||||
subject = "Web error: Failed adding to google groups"
|
||||
body = "Error code: {}\nError details: {}\nEmail that was not added: {}\n\nAdd user manually to jäsenet groups.".format(
|
||||
|
||||
Reference in New Issue
Block a user