use thiserror;
#[derive(std::fmt::Debug, thiserror::Error)]
pub enum Error {
#[error(transparent)]
Kff(#[from] Kff),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error(transparent)]
FromUtf8(#[from] std::string::FromUtf8Error),
}
#[derive(std::fmt::Debug, thiserror::Error)]
pub enum Kff {
#[error("Missing magic number {0}")]
MissingMagic(String),
#[error("Major version number {0} is upper than support (1 or lower)")]
HighMajorVersionNumber(u8),
#[error("Minor version number {0} is upper than support (0 or lower)")]
HighMinorVersionNumber(u8),
#[error("Encoding {0:#b} isn't a valid encoding, each pair of bits must be different")]
BadEncoding(u8),
#[error("Value with name '{0}' isn't present in Values this kff file seems not correct")]
FieldIsMissing(String),
#[error("Value max `{0}` seems to be too large")]
MaxValueIsTooLarge(u64),
#[error("Footer size isn't correct of file not respect footer good practices")]
FooterSizeNotCorrect,
#[error("'{0}' isn't a valid Kff section prefix")]
NotASectionPrefix(u8),
#[error("Section at position isn't an index section")]
NotAnIndex,
#[error("Variable 'first_index' not present in footer it's seems not be an indexed Kff file")]
NoFirstIndex,
#[error("To read a kmers of a section, KFF file should be fully indexed")]
NoIndex,
#[error("No value section before target section")]
NoValueSectionBeforeTarget,
#[error("Not a kmer section, you try to read a section isn't ")]
NotAKmerSection,
}
pub type Result<T> = core::result::Result<T, Error>;