Skip to main content

Module error

Module error 

Source
Expand description

The crate’s error type.

One enum for everything, because a caller mapping failures onto its own categories — the Python layer onto exception types, a CLI onto exit codes — wants a single exhaustive match, and that is the only shape that stays complete as variants are added.

Every variant carries its parts, never a pre-assembled message. What a failure is and how it reads are different concerns: a caller inspecting Error::UnknownChromosome can reach the id and the names that were available without parsing English out of a string, and the sentence is built by std::fmt::Display at the point something prints it.

Error::Format and Error::Corrupt are separate because they are different failures with different remedies: Format is “this is not the file you said it was” — the wrong path, the wrong tool — and Corrupt is “it is, and its bytes disagree with themselves”, which is a damaged file or a bug in whatever wrote it.

Enums§

Error

Functions§

check_range
Bounds check for a field read out of a buffer whose length came from the file. Format code calls this before slicing so that a bad count is a Error::Corrupt a caller can catch, not a panic it cannot.

Type Aliases§

Result