Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Validata
Validata UI
Commits
407c0315
Commit
407c0315
authored
Jun 18, 2019
by
Pierre Dittgen
Browse files
Better handle source errors
parent
4a3ed9a9
Pipeline
#1013
failed with stage
in 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
validata_ui/views.py
View file @
407c0315
...
...
@@ -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: {}"
.
format
(
json_response
.
get
(
'message'
)))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment