calibrated_explanations.core.exceptions¶
Compatibility shim exposing the exception hierarchy under core.
Historically the central exception types lived directly under
calibrated_explanations.core. They were migrated to
calibrated_explanations.utils.exceptions (ADR-002) but documentation,
type-check configuration and downstream code still import from
calibrated_explanations.core.exceptions. Sphinx therefore attempts to
autodoc this module during the docs build. Without a real module the
import fails, bringing the entire docs workflow down.
To keep the public API stable we provide a light re-export module that simply
forwards the canonical implementations from utils.exceptions. This keeps
documentation, mypy configuration, and any downstream imports working without
duplicating logic.
- exception calibrated_explanations.core.exceptions.CalibratedError(message: str, *, details: dict[str, Any] | None = None)[source]¶
Bases:
ExceptionAttach structured error details alongside the user-facing message.
- exception calibrated_explanations.core.exceptions.ConfigurationError(message: str, *, details: dict[str, Any] | None = None)[source]¶
Bases:
CalibratedErrorAttach structured error details alongside the user-facing message.
- exception calibrated_explanations.core.exceptions.ConvergenceError(message: str, *, details: dict[str, Any] | None = None)[source]¶
Bases:
CalibratedErrorAttach structured error details alongside the user-facing message.
- exception calibrated_explanations.core.exceptions.DataShapeError(message: str, *, details: dict[str, Any] | None = None)[source]¶
Bases:
ValidationErrorAttach structured error details alongside the user-facing message.
- exception calibrated_explanations.core.exceptions.ModelNotSupportedError(message: str, *, details: dict[str, Any] | None = None)[source]¶
Bases:
CalibratedErrorAttach structured error details alongside the user-facing message.
- exception calibrated_explanations.core.exceptions.NotFittedError(message: str, *, details: dict[str, Any] | None = None)[source]¶
Bases:
CalibratedErrorAttach structured error details alongside the user-facing message.
- exception calibrated_explanations.core.exceptions.SerializationError(message: str, *, details: dict[str, Any] | None = None)[source]¶
Bases:
CalibratedErrorAttach structured error details alongside the user-facing message.
- exception calibrated_explanations.core.exceptions.ValidationError(message: str, *, details: dict[str, Any] | None = None)[source]¶
Bases:
CalibratedErrorAttach structured error details alongside the user-facing message.
- calibrated_explanations.core.exceptions.explain_exception(e: Exception) str[source]¶
Return a human-readable multi-line description of an exception.
Formats library-specific
CalibratedErrorinstances with structured details for diagnostics and logging. For other exceptions, returns the standard string representation.- Parameters:
e (Exception) – The exception to format.
- Returns:
Multi-line human-readable message. For CalibratedError, includes class name, message, and details dict if present.
- Return type:
str
Examples
>>> from calibrated_explanations.utils.exceptions import ValidationError, explain_exception >>> e = ValidationError("x must not be empty", details={"param": "x", "requirement": "non-empty"}) >>> print(explain_exception(e)) ValidationError: x must not be empty Details: {'param': 'x', 'requirement': 'non-empty'}