Commit bc267bff authored by Pierre Dittgen's avatar Pierre Dittgen

Better error handling

parent 0c777a52
......@@ -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()
......
Markdown is supported
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