Repository navigation
refactor(error)!: Error is non_exhaustive, and failures BasicFileInfo and Cfb did not describe get their own variants - #898
Conversation
…15 copies of simple_decoder! generated
# Conflicts: # CHANGELOG.md
…turns a reference into it
… and Cfb did not describe get their own variants
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 57455181ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…nt instead of raising OSError
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a2e0c29bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
# Conflicts: # CHANGELOG.md
…alformed; a schema without ADocument raises ValueError in Python
Summary
Errorbecomes#[non_exhaustive]and gains four variants that say what failed, replacing the places that reported unrelated failures asError::BasicFileInfo(39 before this PR and #894) orError::Cfb:SchemaMismatch { decoder, schema }BasicFileInfo("WallDecoder received wrong schema: ...")SimpleDecoder, the ArcWall decoderNoDecoder(class)BasicFileInfo("no typed decoder registered for class ...")elements::decode_typed*MissingClass("ADocument")BasicFileInfo("ADocument not in schema")ADocumentwalkMalformed { what, detail }BasicFileInfo(...),Cfb("ArcWall decode: ...")ADocumentdecode,Global/ElemTable, ArcWall and opening-index recordsEvery variant is now documented, and
src/error.rshas a module doc.Motivation
The 2026-10-23 style audit (Rust API Guidelines C-GOOD-ERR; Google's "Reporting errors";
#[non_exhaustive]on public enums).Erroralready gained variants three times; each was a breaking change for anyone matching on it.Erroris part of the stable API under #873, so this belongs before 1.0. Depends on #894 (it convertsSimpleDecoder's error); until #894 merges, this PR's diff includes #894's.Changes
src/error.rs:#[non_exhaustive], the four variants, docs.SimpleDecoder,elements::arc_wall,elements/mod.rs,walker.rs,elem_table.rs,arc_wall_record.rs,rect_opening_index.rs: the conversions (script, then rustfmt).CHANGELOG.md: a breaking Changed entry.Not changed: the existing variants' payloads and messages (
tests/rvt_info_cli.rs, a Python test and the Python package's docs quote them), andwriter::file_guid'sBasicFileInfo, which does describe a BasicFileInfo parse failure.Cfb(String)still drops its source error: its 26 sites each format their own context, so keeping the source is a payload change with its own design, tracked in #899.Testing
No unit tests (banned). The matches on
Erroroutside the crate (rvt-py,rvt-info,rvt-corpus, the tests) already have wildcard arms; CI builds all of them. Nothing asserts on the replaced messages. Measure is unaffected: no decode path changes, only the error a refusal carries.Audit-honesty checklist
Legal and contribution hygiene
Breaking changes
matchonrvt::Errorneeds a wildcard arm. Code that matchedError::BasicFileInfoorError::Cfbto catch a wrong-schema, missing-decoder or malformed-record failure matches the new variant instead.Screenshots or output samples
N/A.