Skip to content

Commit

Permalink
Merge pull request #251 from dandi/properly-handle-fetch-errors
Browse files Browse the repository at this point in the history
Properly handle failed requests to retrieve the schema
  • Loading branch information
yarikoptic authored Sep 5, 2024
2 parents 6fc16b8 + dd8a837 commit d2f07e2
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 d2f07e2

Please sign in to comment.