Skip to content

Commit

Permalink
Properly handle failed requests to retrieve the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna committed Aug 21, 2024
1 parent 6fc16b8 commit dd8a837
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dandischema/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit dd8a837

Please sign in to comment.