feat(core): add exception hierarchy
Implement VeritextError base class and specialised exceptions: MetricError, ValidationError, BenchmarkError, ConfigurationError, DependencyError.
This commit is contained in:
4
src/veritext/__init__.py
Normal file
4
src/veritext/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
"""Veritext: Semantic text validation framework for Python."""
|
||||||
|
|
||||||
|
__version__ = "0.1.0-dev"
|
||||||
|
__all__ = ["__version__"]
|
||||||
36
src/veritext/core/__init__.py
Normal file
36
src/veritext/core/__init__.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
"""Core module: shared types, tokenisation, and configuration."""
|
||||||
|
|
||||||
|
from veritext.core.exceptions import (
|
||||||
|
BenchmarkError,
|
||||||
|
ConfigurationError,
|
||||||
|
DependencyError,
|
||||||
|
EmbeddingError,
|
||||||
|
InvalidThresholdError,
|
||||||
|
MetricError,
|
||||||
|
RegressionDetectedError,
|
||||||
|
StorageError,
|
||||||
|
TokenisationError,
|
||||||
|
ValidationError,
|
||||||
|
VeritextError,
|
||||||
|
)
|
||||||
|
from veritext.core.tokenisation import Tokeniser, WordTokeniser
|
||||||
|
from veritext.core.types import CheckResult, ValidationContext, ValidationResult
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"BenchmarkError",
|
||||||
|
"CheckResult",
|
||||||
|
"ConfigurationError",
|
||||||
|
"DependencyError",
|
||||||
|
"EmbeddingError",
|
||||||
|
"InvalidThresholdError",
|
||||||
|
"MetricError",
|
||||||
|
"RegressionDetectedError",
|
||||||
|
"StorageError",
|
||||||
|
"TokenisationError",
|
||||||
|
"Tokeniser",
|
||||||
|
"ValidationContext",
|
||||||
|
"ValidationError",
|
||||||
|
"ValidationResult",
|
||||||
|
"VeritextError",
|
||||||
|
"WordTokeniser",
|
||||||
|
]
|
||||||
45
src/veritext/core/exceptions.py
Normal file
45
src/veritext/core/exceptions.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
"""Exception hierarchy for Veritext."""
|
||||||
|
|
||||||
|
|
||||||
|
class VeritextError(Exception):
|
||||||
|
"""Base exception for all Veritext errors."""
|
||||||
|
|
||||||
|
|
||||||
|
class MetricError(VeritextError):
|
||||||
|
"""Error during metric computation."""
|
||||||
|
|
||||||
|
|
||||||
|
class TokenisationError(MetricError):
|
||||||
|
"""Error during text tokenisation."""
|
||||||
|
|
||||||
|
|
||||||
|
class EmbeddingError(MetricError):
|
||||||
|
"""Error computing embeddings (semantic similarity)."""
|
||||||
|
|
||||||
|
|
||||||
|
class ValidationError(VeritextError):
|
||||||
|
"""Error during validation."""
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidThresholdError(ValidationError):
|
||||||
|
"""Invalid threshold value provided."""
|
||||||
|
|
||||||
|
|
||||||
|
class BenchmarkError(VeritextError):
|
||||||
|
"""Error during benchmarking."""
|
||||||
|
|
||||||
|
|
||||||
|
class StorageError(BenchmarkError):
|
||||||
|
"""Error reading/writing benchmark storage."""
|
||||||
|
|
||||||
|
|
||||||
|
class RegressionDetectedError(BenchmarkError):
|
||||||
|
"""Quality regression detected (used in CI)."""
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigurationError(VeritextError):
|
||||||
|
"""Invalid configuration."""
|
||||||
|
|
||||||
|
|
||||||
|
class DependencyError(VeritextError):
|
||||||
|
"""Optional dependency not installed."""
|
||||||
0
src/veritext/py.typed
Normal file
0
src/veritext/py.typed
Normal file
Reference in New Issue
Block a user