Commit ac85eaab authored by Pierre Dittgen's avatar Pierre Dittgen

Display errors if a schema is not valid

parent 45d4ec25
......@@ -26,7 +26,7 @@ def generate_schema_from_url_func(session):
response = session.get(url)
response.raise_for_status()
descriptor = response.json()
return tableschema.Schema(descriptor)
return tableschema.Schema(descriptor, strict=True)
return tableschema_from_url
......
......@@ -13,6 +13,7 @@ from operator import itemgetter
from pathlib import Path
from urllib.parse import urlencode, urljoin
import datapackage
import jsonschema
import requests
import tableschema
......@@ -109,6 +110,10 @@ class SchemaInstance:
log.exception(e)
flash_error("Format de schéma non reconnu")
abort(redirect(url_for('home')))
except datapackage.exceptions.ValidationError as e:
log.exception(e)
flash_error("Le schéma {} n'est pas valide".format(self.url))
abort(redirect(url_for('home')))
except Exception as e:
log.exception(e)
flash_error("Erreur lors de l'obtention du schéma")
......
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