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
bc267bff
Commit
bc267bff
authored
Jun 03, 2019
by
Pierre Dittgen
Browse files
Better error handling
parent
0c777a52
Changes
1
Hide whitespace changes
Inline
Side-by-side
validata_ui/views.py
View file @
bc267bff
...
...
@@ -258,8 +258,15 @@ def validate(schema_url, source: ValidataSource):
data
=
{
'schema'
:
schema_url
}
req
=
requests
.
post
(
api_url
,
data
=
data
,
files
=
files
,
headers
=
headers
)
# 400
if
req
.
status_code
==
400
:
json_response
=
req
.
json
()
flash_error
(
"Une erreur est survenue durant la validation: {}"
.
format
(
json_response
.
get
(
'message'
)))
return
redirect
(
url_for
(
"home"
))
if
not
req
.
ok
:
flash_error
(
"
{}: :("
.
format
(
req
.
status_code
)
)
flash_error
(
"
Un erreur s'est produite côté serveur :-("
)
return
redirect
(
url_for
(
"home"
))
json_response
=
req
.
json
()
...
...
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