feat(core): add exception hierarchy

Implement VeritextError base class and specialised exceptions:
MetricError, ValidationError, BenchmarkError, ConfigurationError, DependencyError.
This commit is contained in:
2026-02-03 16:15:55 +00:00
parent 60aaa33327
commit a1e862550c
4 changed files with 85 additions and 0 deletions

4
src/veritext/__init__.py Normal file
View File

@@ -0,0 +1,4 @@
"""Veritext: Semantic text validation framework for Python."""
__version__ = "0.1.0-dev"
__all__ = ["__version__"]

View 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",
]

View 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
View File