1
0
forked from ScoDoc/ScoDoc

Enhance critical_error handling.

This commit is contained in:
Emmanuel Viennet 2024-05-19 22:53:54 +02:00
parent 22d90215a0
commit 000e016985
3 changed files with 16 additions and 10 deletions

View File

@ -637,14 +637,12 @@ def critical_error(msg):
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
log(f"\n*** CRITICAL ERROR: {msg}") 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() clear_scodoc_cache()
raise ScoValueError( raise ScoValueError(
f""" f"""
Une erreur est survenue. Une erreur est survenue, veuillez -essayer.
Si le problème persiste, merci de contacter le support ScoDoc via
{scu.SCO_DISCORD_ASSISTANCE}
{msg} {msg}
""" """

View File

@ -9,9 +9,9 @@ import datetime
from threading import Thread from threading import Thread
from flask import current_app, g 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.departements import Departement
from app.models.config import ScoDocSiteConfig from app.models.config import ScoDocSiteConfig
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
@ -20,7 +20,15 @@ from app.scodoc import sco_preferences
def send_async_email(app, msg): def send_async_email(app, msg):
"Send an email, async" "Send an email, async"
with app.app_context(): 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( def send_email(

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.966" SCOVERSION = "9.6.967"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"
@ -14,7 +14,7 @@ SCONEWS = """
<li>Nouveaux bulletins BUT compacts</li> <li>Nouveaux bulletins BUT compacts</li>
<li>Nouvelle gestion des absences et assiduité</li> <li>Nouvelle gestion des absences et assiduité</li>
<li>Mise à jour logiciels: Debian 12, Python 3.11, ...</li> <li>Mise à jour logiciels: Debian 12, Python 3.11, ...</li>
<li>Evaluations bonus</li> <li>Évaluations bonus</li>
</ul> </ul>
<li>ScoDoc 9.5 (juillet 2023)</li> <li>ScoDoc 9.5 (juillet 2023)</li>