Spaces:
Running on Zero
Running on Zero
File size: 2,264 Bytes
0f2ecac 413d5a1 d840c10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | """Typed exceptions for GCMD classifier deterministic components."""
class GCMDClassifierError(Exception):
"""Base exception for GCMD classifier errors."""
class VocabularyError(GCMDClassifierError):
"""Base exception for vocabulary loading and indexing errors."""
class MalformedHierarchyError(VocabularyError):
"""Raised when a hierarchy node is missing required structure or fields."""
class DuplicateUUIDError(VocabularyError):
"""Raised when the hierarchy contains the same UUID more than once."""
class DuplicateCanonicalPathError(VocabularyError):
"""Raised when one canonical path is assigned to multiple UUIDs."""
class InvalidHierarchyTransitionError(VocabularyError):
"""Raised when a node appears under an invalid hierarchy parent level."""
class VocabularyLookupError(VocabularyError):
"""Raised when a requested vocabulary concept or relationship is missing."""
class ArticleError(GCMDClassifierError):
"""Base exception for article loading and validation errors."""
class ArticleFileNotFoundError(ArticleError):
"""Raised when an article source file does not exist."""
class ArticleJSONDecodeError(ArticleError):
"""Raised when an article source file contains invalid JSON."""
class ArticleTopLevelTypeError(ArticleError):
"""Raised when an article source file is not a top-level JSON list."""
class ModelError(GCMDClassifierError):
"""Base exception for model provider and structured-output errors."""
class RetryableModelError(ModelError):
"""Raised for temporary model failures eligible for retry."""
class NonRetryableModelError(ModelError):
"""Raised for model failures that should not be retried."""
class StructuredModelResponseError(NonRetryableModelError):
"""Raised when a model response cannot be validated into the requested schema."""
class UnknownCandidateIDError(NonRetryableModelError):
"""Reserved for later routing stages that validate selected candidate IDs."""
class ModelRetriesExhaustedError(ModelError):
"""Raised when retryable model failures exceed the configured retry budget."""
def __init__(self, message: str, *, retry_count: int) -> None:
super().__init__(message)
self.retry_count = retry_count
|