From 9e179d5e061a3b393efe1404520a775f7b84aa30 Mon Sep 17 00:00:00 2001 From: Ojakoo Date: Mon, 5 Sep 2022 10:40:29 +0300 Subject: [PATCH] Added error handling for incorrectly formatted google creds --- webapp/utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/webapp/utils.py b/webapp/utils.py index d79446c..759f8a4 100644 --- a/webapp/utils.py +++ b/webapp/utils.py @@ -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) + +