Catch errors in Django-Q2 email reporter
This commit is contained in:
parent
edd26e3f75
commit
6ca6f1390c
@ -1,4 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
from django.views.debug import ExceptionReporter
|
from django.views.debug import ExceptionReporter
|
||||||
from django.core import mail
|
from django.core import mail
|
||||||
@ -9,6 +10,7 @@ class AdminEmailReporter:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def report(self):
|
def report(self):
|
||||||
|
try:
|
||||||
reporter = ExceptionReporter(None, *sys.exc_info())
|
reporter = ExceptionReporter(None, *sys.exc_info())
|
||||||
message = f"Failed to run task\n{reporter.get_traceback_text()}"
|
message = f"Failed to run task\n{reporter.get_traceback_text()}"
|
||||||
html_message = reporter.get_traceback_html()
|
html_message = reporter.get_traceback_html()
|
||||||
@ -18,3 +20,5 @@ class AdminEmailReporter:
|
|||||||
# fail_silently=True,
|
# fail_silently=True,
|
||||||
html_message=html_message,
|
html_message=html_message,
|
||||||
)
|
)
|
||||||
|
except Exception:
|
||||||
|
print(traceback.format_exc())
|
||||||
|
Loading…
Reference in New Issue
Block a user