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§
- Document
Error - A Document operation is invalid, or a plain value is not a legal Document.
- Format
Error - An unknown format name was looked up in the format registry – raised by
crate::registry::get_format(and thereforecrate::document::Doc::from_format/to_format/check_format), mirroring Python’sOmnistError(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 reusingDocumentError/SchemaError) because “no such registered format” isn’t a Document-shape or Schema-definition problem – it’s specifically a registry lookup miss, issue #31. - Materialize
Error - A freshly-read node could not be made to conform to a
Schema– raised bycrate::materialize::materialize(issue #14), mirroring Python’sParseError(str(res), errors=res.errors)raised by~/dev/omnist/omnist/deserialize.py. Wraps acrate::schema::ValidationResultdirectly rather than duplicating its(path, message, code)collection machinery –materializealready walks the tree using the exact same shape-check rulesSchema::validatedoes, so its error report reuses the same collector type. - Parse
Error - An OML source string could not be parsed – raised by
crate::oml::read_oml, mirroring Python’sParseErrorin~/dev/omnist/omnist/errors.py. Carries the same “line N, col N: msg” convention the Python reference’s scanner/parser produce. - Schema
Error - 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]. - Write
Error - 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, bystrict=trueformat writers viacrate::report::finish_write, mirroring Python’sWriteError(str(rep), report=rep). The optionalcrate::report::WriteReportcarries the adjustments that triggered a strict-mode raise;Nonefor every otherWriteErrorsite (e.g. the depth guard, which has no report to attach).
Enums§
- Omnist
Error - Crate-wide top-level error, mirroring Python’s
OmnistErrorbase class.