From 9e521e3746498e88047bf77429003cca0ef925a8 Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Thu, 1 Feb 2024 12:32:31 -0500 Subject: [PATCH] Remove note from error messages --- dandi/dandiapi.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/dandi/dandiapi.py b/dandi/dandiapi.py index 0dcdbeede..d50b94827 100644 --- a/dandi/dandiapi.py +++ b/dandi/dandiapi.py @@ -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 @@ -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]: """ @@ -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`"""