From dd8a837048b289da71a6f30feef9b0743f80fef5 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Wed, 21 Aug 2024 07:44:50 -0400 Subject: [PATCH] Properly handle failed requests to retrieve the schema --- dandischema/metadata.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dandischema/metadata.py b/dandischema/metadata.py index 4c81325..309707e 100644 --- a/dandischema/metadata.py +++ b/dandischema/metadata.py @@ -184,10 +184,12 @@ def _validate_asset_json(data: dict, schema_dir: Union[str, Path]) -> None: @lru_cache def _get_schema(schema_version: str, schema_name: str) -> Any: - return requests.get( + r = requests.get( "https://raw.githubusercontent.com/dandi/schema/" f"master/releases/{schema_version}/{schema_name}" - ).json() + ) + r.raise_for_status() + return r.json() def validate(