Skip to main content

Module error

Module error 

Source
Expand description

Error hierarchy, thiserror-based (per issue #1 §5).

OmnistError is the crate-wide top-level error; each module contributes its own leaf error type as a variant (mirroring Python’s OmnistError/SchemaError/ParseError/WriteError/DocumentError hierarchy in ~/dev/omnist/omnist/errors.py). This issue (#4) adds only DocumentError; the other leaf types land with their own modules.

Structs§

DocumentError
A Document operation is invalid, or a plain value is not a legal Document.
FormatError
An unknown format name was looked up in the format registry – raised by crate::registry::get_format (and therefore crate::document::Doc::from_format/to_format/check_format), mirroring Python’s OmnistError(f"unknown format {name!r}; registered: ...") raised directly (not as a distinct exception subclass) in ~/dev/omnist/omnist/registry.py::get_format. Given its own leaf type here (rather than reusing DocumentError/SchemaError) because “no such registered format” isn’t a Document-shape or Schema-definition problem – it’s specifically a registry lookup miss, issue #31.
MaterializeError
A freshly-read node could not be made to conform to a Schema – raised by crate::materialize::materialize (issue #14), mirroring Python’s ParseError(str(res), errors=res.errors) raised by ~/dev/omnist/omnist/deserialize.py. Wraps a crate::schema::ValidationResult directly rather than duplicating its (path, message, code) collection machinery – materialize already walks the tree using the exact same shape-check rules Schema::validate does, so its error report reuses the same collector type.
ParseError
An OML source string could not be parsed – raised by crate::oml::read_oml, mirroring Python’s ParseError in ~/dev/omnist/omnist/errors.py. Carries the same “line N, col N: msg” convention the Python reference’s scanner/parser produce.
SchemaError
A Schema definition is invalid (bad cardinality, duplicate field label, unknown scalar/ref name) – raised by crate::schema, crate::osd, [crate::infer], and [crate::ops::extract].
WriteError
An in-memory Document could not be written – raised by crate::oml::write_oml (depth guard only; OML is otherwise lossless for every Document – see that module’s doc comment) and, from issue #16 onward, by strict=true format writers via crate::report::finish_write, mirroring Python’s WriteError(str(rep), report=rep). The optional crate::report::WriteReport carries the adjustments that triggered a strict-mode raise; None for every other WriteError site (e.g. the depth guard, which has no report to attach).

Enums§

OmnistError
Crate-wide top-level error, mirroring Python’s OmnistError base class.