Commit 6be3cbdc authored by Christophe Benz's avatar Christophe Benz

Don't fail if error loading catalog

parent ee01c9e7
Pipeline #1094 passed with stage
in 4 minutes and 57 seconds
## 0.2.2
Non-breaking changes:
- Don't fail if error loading catalog
## 0.2.1 ## 0.2.1
Non-breaking changes: Non-breaking changes:
......
...@@ -8,11 +8,12 @@ from urllib.parse import quote_plus ...@@ -8,11 +8,12 @@ from urllib.parse import quote_plus
import cachecontrol import cachecontrol
import flask import flask
import jinja2 import jinja2
import opendataschema
import pkg_resources import pkg_resources
import requests import requests
import tableschema import tableschema
import opendataschema
from . import config from . import config
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -51,7 +52,12 @@ class SchemaCatalogRegistry: ...@@ -51,7 +52,12 @@ class SchemaCatalogRegistry:
def build_schema_catalog(self, name): def build_schema_catalog(self, name):
if name in self.url_map: if name in self.url_map:
catalog_url = self.url_map[name] catalog_url = self.url_map[name]
return opendataschema.SchemaCatalog(catalog_url, session=self.session) try:
catalog = opendataschema.SchemaCatalog(catalog_url, session=self.session)
except requests.exceptions.RequestException as exc:
log.exception(exc)
return None
return catalog
return None return None
......
...@@ -427,6 +427,7 @@ def homepage_config_with_schema_metadata(ui_config): ...@@ -427,6 +427,7 @@ def homepage_config_with_schema_metadata(ui_config):
section_name = section['name'] section_name = section['name']
schema_catalog = get_schema_catalog(section_name) schema_catalog = get_schema_catalog(section_name)
if schema_catalog is None: if schema_catalog is None:
section['catalog'] = []
continue continue
schema_list = [] schema_list = []
for ref in schema_catalog.references: for ref in schema_catalog.references:
......
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