forked from ScoDoc/ScoDoc
Enhance critical_error handling.
This commit is contained in:
parent
22d90215a0
commit
000e016985
@ -637,14 +637,12 @@ def critical_error(msg):
|
||||
import app.scodoc.sco_utils as scu
|
||||
|
||||
log(f"\n*** CRITICAL ERROR: {msg}")
|
||||
send_scodoc_alarm(f"CRITICAL ERROR: {msg}", msg)
|
||||
subject = f"CRITICAL ERROR: {msg}".strip()[:68]
|
||||
send_scodoc_alarm(subject, msg)
|
||||
clear_scodoc_cache()
|
||||
raise ScoValueError(
|
||||
f"""
|
||||
Une erreur est survenue.
|
||||
|
||||
Si le problème persiste, merci de contacter le support ScoDoc via
|
||||
{scu.SCO_DISCORD_ASSISTANCE}
|
||||
Une erreur est survenue, veuillez ré-essayer.
|
||||
|
||||
{msg}
|
||||
"""
|
||||
|
14
app/email.py
14
app/email.py
@ -9,9 +9,9 @@ import datetime
|
||||
from threading import Thread
|
||||
|
||||
from flask import current_app, g
|
||||
from flask_mail import Message
|
||||
from flask_mail import BadHeaderError, Message
|
||||
|
||||
from app import mail
|
||||
from app import log, mail
|
||||
from app.models.departements import Departement
|
||||
from app.models.config import ScoDocSiteConfig
|
||||
from app.scodoc import sco_preferences
|
||||
@ -20,7 +20,15 @@ from app.scodoc import sco_preferences
|
||||
def send_async_email(app, msg):
|
||||
"Send an email, async"
|
||||
with app.app_context():
|
||||
mail.send(msg)
|
||||
try:
|
||||
mail.send(msg)
|
||||
except BadHeaderError:
|
||||
log(
|
||||
f"""send_async_email: BadHeaderError
|
||||
msg={msg}
|
||||
"""
|
||||
)
|
||||
raise
|
||||
|
||||
|
||||
def send_email(
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.6.966"
|
||||
SCOVERSION = "9.6.967"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
@ -14,7 +14,7 @@ SCONEWS = """
|
||||
<li>Nouveaux bulletins BUT compacts</li>
|
||||
<li>Nouvelle gestion des absences et assiduité</li>
|
||||
<li>Mise à jour logiciels: Debian 12, Python 3.11, ...</li>
|
||||
<li>Evaluations bonus</li>
|
||||
<li>Évaluations bonus</li>
|
||||
</ul>
|
||||
|
||||
<li>ScoDoc 9.5 (juillet 2023)</li>
|
||||
|
Loading…
Reference in New Issue
Block a user