Module

collections.errors

Collection validation errors.

Provides structured error types for content validation failures with helpful error messages including file locations and fix suggestions.

Classes

ValidationError dataclass
A single validation error for a frontmatter field.
1

A single validation error for a frontmatter field.

Attributes

Name Type Description
field str

Name of the field that failed validation (e.g., "title", "tags[0]")

message str

Human-readable error description

value Any

The actual value that caused the error (for debugging)

expected_type str | None

Expected type description (e.g., "str", "list[str]")

Internal Methods 1
__str__
Format error for display.
0 str
def __str__(self) -> str

Format error for display.

Returns

str

ContentValidationError dataclass
Raised when content fails schema validation. Provides detailed error information including file lo…
4

Raised when content fails schema validation.

Provides detailed error information including file location, specific field errors, and suggestions for fixing.

Inherits from Exception

Attributes

Name Type Description
message str

Summary error message

path Path

Path to the content file that failed validation

errors list[ValidationError]

List of specific field validation errors

collection_name str | None

Name of the collection (if known)

Methods 1

to_dict
Convert to dictionary for JSON serialization.
0 dict[str, Any]
def to_dict(self) -> dict[str, Any]

Convert to dictionary for JSON serialization.

Returns

dict[str, Any]

Dictionary with error details suitable for JSON output.

Internal Methods 3
__post_init__
Initialize Exception with message.
0 None
def __post_init__(self) -> None

Initialize Exception with message.

__str__
Format error with file location and field details.
0 str
def __str__(self) -> str

Format error with file location and field details.

Returns

str

__repr__
Detailed repr for debugging.
0 str
def __repr__(self) -> str

Detailed repr for debugging.

Returns

str

CollectionNotFoundError
Raised when a referenced collection does not exist.
1

Raised when a referenced collection does not exist.

Inherits from Exception

Attributes

Name Type Description
collection_name

Name of the missing collection

available

List of available collection names

Internal Methods 1
__init__
2 None
def __init__(self, collection_name: str, available: list[str] | None = None)
Parameters 2
collection_name str
available list[str] | None
SchemaError
Raised when a schema definition is invalid. This indicates a problem with how the schema was defin…
1

Raised when a schema definition is invalid.

This indicates a problem with how the schema was defined, not with the content being validated against it.

Inherits from Exception

Attributes

Name Type Description
schema_name

Name of the schema class

message

Description of the schema problem

Internal Methods 1
__init__
2 None
def __init__(self, schema_name: str, message: str)
Parameters 2
schema_name str
message str