Added error handling for incorrectly formatted google creds

This commit is contained in:
Ojakoo
2022-09-05 10:40:29 +03:00
parent ea9a732803
commit 9e179d5e06
+13
View File
@@ -157,3 +157,16 @@ def add_to_mailinglist(email: str):
)
send_email(to, subject, body)
except ValueError as err:
logging.exception("Formatting of google credentials is incorrect")
if DEPLOY_ENV == "production":
to = "ilari.ojakorpi@sahkoinsinoorikilta.fi"
subject = "Web error: Failed adding to google groups"
body = "Google credential formatted incorretly\nEmail that was not added: {}\n\nAdd user manually to jäsenet groups.".format(
email
)
send_email(to, subject, body)