Files
AIRegulation-DocAnalysis/backend/app/shared/errors.py

31 lines
1011 B
Python
Raw Normal View History

"""Define shared backend exception types."""
from __future__ import annotations
class VectorStoreSchemaError(RuntimeError):
"""Signal that the active vector store schema does not match backend expectations."""
def __init__(
self,
*,
message: str,
host: str,
db_name: str,
collection_name: str,
expected_fields: list[str],
actual_fields: list[str],
) -> None:
"""Initialize the vector store schema error details."""
self.host = host
self.db_name = db_name
self.collection_name = collection_name
self.expected_fields = expected_fields
self.actual_fields = actual_fields
# Keep the message self-contained so runtime logs show the full mismatch context.
details = (
f"{message} | host={host} db={db_name} collection={collection_name} "
f"expected_fields={expected_fields} actual_fields={actual_fields}"
)
super().__init__(details)