Commit 407c0315 authored by Pierre Dittgen's avatar Pierre Dittgen
Browse files

Better handle source errors

parent 4a3ed9a9
Pipeline #1013 failed with stage
in 21 seconds
......@@ -328,9 +328,14 @@ def validate(schema_instance: SchemaInstance, source: ValidataResource):
# 400
if req.status_code == 400:
json_response = req.json()
if json_response.get('message') == 'Missing headers':
flash_error("Impossible d'extraire les en-têtes du fichier tabulaire")
return redirect(compute_validation_form_url(schema_instance))
if json_response.get('_meta') and json_response.get('_meta').get('args'):
response_args = json_response.get('_meta').get('args')
if response_args.get('code') == 'cant_detect_csv_dialect':
flash_error("Format de fichier CSV non reconnu")
return redirect(compute_validation_form_url(schema_instance))
if response_args.get('code') == 'missing_headers':
flash_error("Impossible d'extraire les noms de colonne du fichier")
return redirect(compute_validation_form_url(schema_instance))
flash_error("Une erreur est survenue durant la validation: {}"
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