1use thiserror::Error;
2
3#[derive(Debug, Error)]
5#[non_exhaustive]
6pub enum Error {
7 #[error("The number of labels {expected} does not match the count anticipated from the data matrix {actual}")]
9 IncorrectMatrixLabels { expected: usize, actual: usize },
10
11 #[error("Line {line} does not contain enough columns (need at least {needed}): '{content}'")]
13 NotEnoughColumns {
14 line: usize,
15 needed: usize,
16 content: String,
17 },
18
19 #[error("Line {line} has too many columns when expecting single value: '{content}'")]
21 TooManyColumns { line: usize, content: String },
22
23 #[error("Invalid value at line {line}: '{content}'")]
25 ParseError { line: usize, content: String },
26
27 #[error(
29 "Incorrect number of data values: {n_data}; expected a square matrix packed row-wise."
30 )]
31 WrongNumberOfData { n_data: usize },
32
33 #[error("I/O error: {0}")]
35 IoError(#[from] std::io::Error),
36}