diff --git a/.gitignore b/.gitignore index 1366b03..928b68b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ htmlcov docs/_build .cache/* .pytest_cache/ -.hypothesis/* +**/.hypothesis/* geckodriver.log ghostdriver.log cove/lib/org-ids.json diff --git a/lib360dataquality/cove/schema.py b/lib360dataquality/cove/schema.py index ef8d88f..330ddc9 100644 --- a/lib360dataquality/cove/schema.py +++ b/lib360dataquality/cove/schema.py @@ -45,14 +45,24 @@ def __init__(self, data_dir, local_pkg_schema_path=None, local_grant_schema_path self._pkg_schema_obj = json.load(f) else: pkg_schema_url = urljoin(config["schema_host"], self.pkg_schema_name) - self._pkg_schema_obj = get_request(pkg_schema_url).json() + try: + self._pkg_schema_obj = get_request(pkg_schema_url, force_cache=True).json() + except json.JSONDecodeError as exc: + raise Exception("Could not parse JSON from package schema") from exc + except Exception as exc: + raise Exception("Could not fetch package schema") from exc if local_grant_schema_path: with open(local_grant_schema_path) as f: self._schema_obj = json.load(f) else: schema_url = urljoin(config["schema_host"], self.schema_name) - self._schema_obj = get_request(schema_url).json() + try: + self._schema_obj = get_request(schema_url, force_cache=True).json() + except json.JSONDecodeError as exc: + raise Exception("Could not parse JSON from grant schema") from exc + except Exception as exc: + raise Exception("Could not fetch grant schema") from exc # Update the pkg schema to no longer point to an external reference for the # grants schema.