Mail admins when exceptions occur
Enable sending e-mail to ADMINS on failure. This includes exceptions in huey tasks.
Done as part of https://tasks.opencraft.com/browse/OC-2044
JIRA tickets: None Discussions: None Dependencies: None Screenshots: None Sandbox URL: None Merge deadline: None
Testing instructions:
- Add ADMINS to settings.py, e.g.
ADMINS=[("You","aaaaa@example.com")]
, or the equivalent syntax in.env
(with lists instead of tuples, and everything surrounded by single quotes) - Add to your
.env
:
DEBUG=false
ADMINS='["something@example.com"]'
ALLOWED_HOSTS='["localhost"]'
SERVER_EMAIL='something@example.com'
DEFAULT_FROM_EMAIL='something@example.com'
EMAIL_HOST='localhost'
- (You don't really need a mail server because Django will show the message in the console)
- In
watch_pr/tasks.py
, add araise ValueError("something")
inside the task make run
- After less than 2 minutes you'll see an exception raised and the e-mail it would be sent
Reviewers
-
TBD
Author concerns: None Settings: None