Commit ce6ccb1b authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Better error display on source error

parent ae4b0349
......@@ -8,7 +8,6 @@ import json
import logging
import subprocess
import tempfile
import time
from datetime import datetime
from io import BytesIO
from operator import itemgetter
......@@ -220,6 +219,15 @@ def validate(schema_code, source: ValidataSource):
flash_error('Erreur : format de fichier non supporté')
return redirect(url_for('scdl_validator', val_code=schema_code))
# source_errors = [err for err in validata_core_report['tables'][0]['errors'] if err['code'] == 'source-error']
source_errors = [err for err in validata_core_report['tables'][0]['errors'] if err['code'] == 'source-error']
if source_errors:
err = source_errors[0]
msg = "l'encodage du fichier est invalide. Veuillez le corriger" if 'charmap' in err[
'message'] else err['message']
flash_error('Erreur de source : {}'.format(msg))
return redirect(url_for('scdl_validator', val_code=schema_code))
source_data = extract_source_data(source)
# handle report date
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment