Skip to content

Commit

Permalink
Remove note from error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Feb 1, 2024
1 parent db6f4cf commit 9e521e3
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions dandi/dandiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import click
from dandischema import models
from pydantic import BaseModel, Field, PrivateAttr, ValidationError
from pydantic import BaseModel, Field, PrivateAttr
import requests
import tenacity

Expand Down Expand Up @@ -978,15 +978,7 @@ def get_metadata(self) -> models.Dandiset:
metadata. Consider using `get_raw_metadata()` instead in order to
fetch unstructured, possibly-invalid metadata.
"""
try:
return models.Dandiset.parse_obj(self.get_raw_metadata())
except ValidationError as e:
raise ValueError(
f"{type(e).__name__}: {e}\n\nNote: Only metadata for published"
" Dandiset versions can be expected to be valid. Use"
" get_raw_metadata() instead to get unstructured,"
" possibly-invalid metadata."
)
return models.Dandiset.parse_obj(self.get_raw_metadata())

def get_raw_metadata(self) -> dict[str, Any]:
"""
Expand Down Expand Up @@ -1368,15 +1360,7 @@ def get_metadata(self) -> models.Asset:
valid metadata. Consider using `get_raw_metadata()` instead in
order to fetch unstructured, possibly-invalid metadata.
"""
try:
return models.Asset.parse_obj(self.get_raw_metadata())
except ValidationError as e:
raise ValueError(
f"{type(e).__name__}: {e}\n\nNote: Only metadata for assets in"
" published Dandiset versions can be expected to be valid. Use"
" get_raw_metadata() instead to get unstructured,"
" possibly-invalid metadata."
)
return models.Asset.parse_obj(self.get_raw_metadata())

def get_raw_metadata(self) -> dict[str, Any]:
"""Fetch the metadata for the asset as an unprocessed `dict`"""
Expand Down

0 comments on commit 9e521e3

Please sign in to comment.