Skip to content

Exceptions

Every error polspec raises descends from PolspecError, so one except clause catches the lot. Most also descend from the built-in they replaced, so existing except ValueError handlers keep working. The Errors and findings page explains when each is raised.

PolspecError

PolspecError

Base class for every error polspec raises on its own behalf.

SpecError

SpecError

A declaration that cannot mean anything.

Raised while a ColSpec, ColRule, Check, ForeignKey, FrameSpec or CatSpec is being built: bounds a dtype cannot hold, a rule pointing at a column that does not exist, two columns resolving to one name. Inherits both ValueError and TypeError because it replaces both.

GenerationError

GenerationError

A spec that declares fine cannot be turned into data as asked.

A dtype the engine cannot fill, a cartesian coverage set past the size cap, a foreign key with an empty parent, a unique domain smaller than the row count. Errors raised inside the Rust extension surface as this.

ValidationError

ValidationError

ValidationError(report: Any, errors: list[str] | None = None)

Data does not meet its spec.

Carries the ValidationReport of every violation found as report. errors is the same findings as a plain list of messages, for the common case of printing them.

MultiValidationError

MultiValidationError

MultiValidationError(reports: Any)

Several frames failed validation together, as one registry call.

reports holds the ValidationReport of every spec that failed, keyed by spec name, so failing_rows(), by_code() and the rest are reachable for each of them. report is None: there is no single report here, and picking one of several arbitrarily would be worse than saying so. str() and errors read as they always have -- every failing spec's findings, one after another.

SerializationError

SerializationError

A spec file cannot be written or read.

A dtype with no file representation, a key the reader does not know, a file written by a newer format version.

RegistryError

RegistryError

A collection of specs is inconsistent.

An unknown or duplicated spec name, a cycle in the foreign-key graph, two specs disagreeing about a shared category.

CliError

CliError

An expected failure on the command line, reported without a traceback.