From 5ff9b73da38ae743eefeb42aad9057df782cb2e4 Mon Sep 17 00:00:00 2001 From: Andy Shultz Date: Wed, 30 Nov 2022 10:52:17 -0500 Subject: [PATCH] fix: wrap course goals email handle to report on errors currently this is failing many runs but the exception information is lost at some higher level. Report on it immediately. --- .../management/commands/goal_reminder_email.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/course_goals/management/commands/goal_reminder_email.py b/lms/djangoapps/course_goals/management/commands/goal_reminder_email.py index 3deaf2aedd..8ed453d06b 100644 --- a/lms/djangoapps/course_goals/management/commands/goal_reminder_email.py +++ b/lms/djangoapps/course_goals/management/commands/goal_reminder_email.py @@ -112,7 +112,21 @@ class Command(BaseCommand): def handle(self, *args, **options): """ - Docstring + Handle goal emails across all courses. + + This outer layer calls the inner and reports on any exception that + occurred. + """ + + try: + self._handle_all_goals() + except Exception: # pylint: disable=broad-except + log.exception("Error while sending course goals emails: ") + raise + + def _handle_all_goals(self): + """ + Handle goal emails across all courses Helpful notes for the function: weekday() returns an int 0-6 with Monday being 0 and Sunday being 6