#[non_exhaustive]pub enum Error {
NotAPack,
UnsupportedFormat {
found: u32,
},
UnsupportedSchema {
found: u32,
},
DigestMismatch {
stated: String,
computed: String,
},
NotText,
Malformed(String),
Io(String),
}Expand description
Why a byte sequence is not a pack this reader will serve.
Every variant is a refusal before the first record: a reader that served half a catalogue and then noticed would have already handed out records nothing verified.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotAPack
The first line does not open with the pack’s magic word — this is not a pack at all.
UnsupportedFormat
The pack declares a container format this reader does not implement, named so an operator reads “upgrade the reader” rather than “the file is corrupt”.
UnsupportedSchema
The pack’s documents carry a schema version this reader does not serve — fail closed, by name, exactly as the story’s forward-compatibility note requires.
DigestMismatch
The stated digest is not the digest of the content. Truncation, corruption or a hand-edit; whichever it was, no record is served from bytes that disagree with their own header.
Fields
NotText
The bytes are not valid UTF-8, which a pack — a text container over JSON — always is.
Malformed(String)
Structurally not a version-1 pack: a missing header line, a malformed row, a span pointing outside the payload, a payload shorter than declared. The string names the offender.
Io(String)
Pack::load could not read the file. The message carries the path.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()