caxton.core.errors¶
Every library exception inherits from CaxtonError and carries a semantic path
plus an immutable structured-context snapshot. CaxtonTypeError and
CaxtonValueError also subclass the Python built-ins, so existing handlers keep
working.
See Testing and diagnostics for help locating failures in the document pipeline.
Base¶
Classes:
-
CaxtonError–Base class for every public caxton exception.
-
CaxtonTypeError–Raised when a public argument has an invalid runtime type.
-
CaxtonValueError–Raised when a public argument value violates a local invariant.
-
InvalidOperationError–Raised when an operation is invalid for the current document state.
-
UnsupportedFeatureError–Raised when the selected target cannot represent a requested feature.
Validation¶
Classes:
-
ValidationError–Raised for one or more errors in a semantic document model.
-
SchemaError–Raised when a document schema is invalid.
-
ShapeError–Raised when data dimensions do not match the document schema.
-
ColumnNotFoundError–Raised when a referenced column does not exist.
-
CyclicReferenceError–Raised when semantic references form a dependency cycle.
-
DuplicateColumnError–Raised when a schema contains the same column more than once.
-
Issue–One validation problem with machine-readable context.
-
Notification–Collect validation issues and raise them as one error.
ValidationError
dataclass
¶
SchemaError
dataclass
¶
ShapeError
dataclass
¶
ColumnNotFoundError
dataclass
¶
CyclicReferenceError
dataclass
¶
DuplicateColumnError
dataclass
¶
Issue
dataclass
¶
Issue(message: str, path: str | None = None, code: str | None = None, context: Mapping[str, Any] = dict())
One validation problem with machine-readable context.
Methods:
-
from_error–Create an issue while preserving a validation error's context.
from_error
classmethod
¶
from_error(error: ValidationError) -> Self
Create an issue while preserving a validation error's context.
Returns:
-
Self–An issue containing the error message, path, and context.
Notification
dataclass
¶
Collect validation issues and raise them as one error.
Methods:
-
add–Add an issue, validation error, or plain validation message.
-
extend–Add several issues while preserving their order.
-
raise_if_errors–Raise the configured aggregate error if validation found issues.
Attributes:
-
issues(tuple[Issue, ...]) –Collected issues as an immutable snapshot.
-
has_errors(bool) –Whether at least one issue has been collected.
add
¶
add(issue: Issue | ValidationError | str, *, path: str | None = None, code: str | None = None, context: Mapping[str, Any] | None = None) -> Issue
Add an issue, validation error, or plain validation message.
Returns:
-
Issue–The normalized issue added to this notification.
extend
¶
extend(issues: Iterable[Issue | ValidationError]) -> None
Add several issues while preserving their order.
raise_if_errors
¶
raise_if_errors(message: str = 'Document validation failed', *, error_class: type[ValidationError] = ValidationError) -> None
Raise the configured aggregate error if validation found issues.
error_class selects the raised validation error, so a caller that
collects schema or shape problems reports them under their own type.
Raises:
-
CaxtonTypeError–If
error_classis not a validation error type.
Data¶
Classes:
-
DataSourceError–Base class for data ingestion and row evaluation failures.
-
UnsupportedDataSourceError–Raised when an input cannot be interpreted as row-oriented data.
-
DataSourceConsumedError–Raised when a one-shot source is iterated more than once.
-
DataSourceIterationError–Raised when obtaining the next row from a data source fails.
-
DataEvaluationError–Base class for failures while evaluating row data.
-
FieldAccessError–Raised when an existing attribute fails while being read.
-
MissingFieldError–Raised when a row has no requested field.
-
SourceEvaluationError–Raised when a callable or expression source cannot be evaluated.
-
AggregateEvaluationError–Raised when an aggregation callable or its result is invalid.
-
CyclicColumnError–Raised when semantic columns reference each other in a cycle.
-
GroupingError–Raised when declared group values cannot be ordered.
-
MatrixConflictError–Raised when an unaggregated matrix cell receives multiple values.
DataSourceError
dataclass
¶
UnsupportedDataSourceError
dataclass
¶
DataSourceConsumedError
dataclass
¶
DataSourceIterationError
dataclass
¶
DataEvaluationError
dataclass
¶
FieldAccessError
dataclass
¶
MissingFieldError
dataclass
¶
SourceEvaluationError
dataclass
¶
AggregateEvaluationError
dataclass
¶
CyclicColumnError
dataclass
¶
GroupingError
dataclass
¶
Rendering and templates¶
Classes:
-
RenderError–Raised when a document cannot be rendered.
-
OutputError–Raised when artifact output cannot be delivered to its target.
-
BackendError–Wrap an implementation-specific renderer failure.
-
TemplateError–Base error for template inspection, resolution, and rendering.
-
TemplateFormatError–Raised when a template format cannot be selected safely.
-
TemplateRefError–Base error for invalid logical template targets.
-
MissingTemplateRefError–Raised when a logical reference does not exist in the template.
-
AmbiguousTemplateRefError–Raised when a logical reference has more than one applicable target.
-
IncompatibleTemplateRefError–Raised when a target cannot accept the declared semantic content.
-
InvalidTemplateRefError–Raised when a template target is malformed or cannot be located.
RenderError
dataclass
¶
OutputError
dataclass
¶
BackendError
dataclass
¶
TemplateError
dataclass
¶
TemplateFormatError
dataclass
¶
TemplateRefError
dataclass
¶
MissingTemplateRefError
dataclass
¶
AmbiguousTemplateRefError
dataclass
¶
Warnings¶
Classes:
-
CaxtonWarning–Base class for every warning emitted by caxton.
-
DocumentWarning–Base category retained for document-generation warnings.
-
PerformanceWarning–Warn about an operation with a potentially surprising runtime cost.
-
ExperimentalFeatureWarning–Warn that an API or capability is experimental.
DocumentWarning
¶
Bases: CaxtonWarning
Base category retained for document-generation warnings.
PerformanceWarning
¶
Bases: DocumentWarning
Warn about an operation with a potentially surprising runtime cost.
ExperimentalFeatureWarning
¶
Bases: DocumentWarning
Warn that an API or capability is experimental.