Skip to content

Commit dd8a837

Browse files
committed
Properly handle failed requests to retrieve the schema
1 parent 6fc16b8 commit dd8a837

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dandischema/metadata.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,12 @@ def _validate_asset_json(data: dict, schema_dir: Union[str, Path]) -> None:
184184

185185
@lru_cache
186186
def _get_schema(schema_version: str, schema_name: str) -> Any:
187-
return requests.get(
187+
r = requests.get(
188188
"https://raw.githubusercontent.com/dandi/schema/"
189189
f"master/releases/{schema_version}/{schema_name}"
190-
).json()
190+
)
191+
r.raise_for_status()
192+
return r.json()
191193

192194

193195
def validate(

0 commit comments

Comments
 (0)