fix: Raise NotFoundError in list_eval_sets function when app_name doesn't exist

PiperOrigin-RevId: 784216832
This commit is contained in:
Ankur Sharma
2025-07-17 09:53:26 -07:00
committed by Copybara-Service
parent 377b5a9b78
commit b17d8b6e36
3 changed files with 20 additions and 2 deletions
@@ -36,7 +36,11 @@ class EvalSetsManager(ABC):
@abstractmethod
def list_eval_sets(self, app_name: str) -> list[str]:
"""Returns a list of EvalSets that belong to the given app_name."""
"""Returns a list of EvalSets that belong to the given app_name.
Raises:
NotFoundError: If the app_name doesn't exist.
"""
@abstractmethod
def get_eval_case(
@@ -23,6 +23,7 @@ from google.cloud import exceptions as cloud_exceptions
from google.cloud import storage
from typing_extensions import override
from ..errors.not_found_error import NotFoundError
from ._eval_sets_manager_utils import add_eval_case_to_eval_set
from ._eval_sets_manager_utils import delete_eval_case_from_eval_set
from ._eval_sets_manager_utils import get_eval_case_from_eval_set
@@ -130,7 +131,7 @@ class GcsEvalSetsManager(EvalSetsManager):
eval_sets.append(eval_set_id)
return sorted(eval_sets)
except cloud_exceptions.NotFound as e:
raise ValueError(
raise NotFoundError(
f"App `{app_name}` not found in GCS bucket `{self.bucket_name}`."
) from e