minimap2_paf_io/error/mod.rs
1/// The result type of this crate using the error type of this crate.
2pub type Result<T> = std::result::Result<T, Error>;
3
4/// All errors that can occur while parsing.
5///
6/// Printing is error-free, except for IO errors.
7/// Therefore when printing, Rust's [std::io::Error] is used.
8#[derive(Debug)]
9pub enum Error {
10 /// An I/O error.
11 IOError(std::io::Error),
12
13 /// Parsing error when parsing the column into the expected type.
14 ColumnParseError,
15
16 /// The line was ended, but it was not expected (e.g. further columns are expected instead).
17 UnexpectedEndOfLine,
18
19 /// The file was ended, but it was not expected (e.g. further columns are expected instead).
20 UnexpectedEndOfFile,
21
22 /// An unexpected character was found.
23 UnexpectedCharacter,
24
25 /// An optional column with an unexpected name or type was found.
26 UnexpectedOptionalColumn {
27 /// The header of the column, or a part of it.
28 /// The header is the name and type.
29 column_header: String,
30 },
31
32 /// A cigar string could not be parsed.
33 MalformedCigar,
34
35 /// An alignment difference string could not be parsed.
36 MalformedAlignmentDifference,
37
38 /// Quick and dirty: simply use strings to report errors.
39 Message(String),
40}
41
42impl From<std::io::Error> for Error {
43 fn from(error: std::io::Error) -> Self {
44 Self::IOError(error)
45 }
46}