antecedent_stats/
error.rs1use core::fmt;
6
7#[derive(Clone, Debug, Eq, PartialEq)]
9pub enum StatsError {
10 Shape {
12 message: &'static str,
14 },
15 RankDeficient {
17 rank: usize,
19 ncols: usize,
21 },
22 NonPositiveVariance {
24 message: &'static str,
26 },
27 Backend(String),
29}
30
31impl fmt::Display for StatsError {
32 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
33 match self {
34 Self::Shape { message } => write!(f, "shape error: {message}"),
35 Self::RankDeficient { rank, ncols } => {
36 write!(f, "rank deficient: rank={rank} ncols={ncols}")
37 }
38 Self::NonPositiveVariance { message } => {
39 write!(f, "non-positive variance: {message}")
40 }
41 Self::Backend(msg) => write!(f, "backend error: {msg}"),
42 }
43 }
44}
45
46impl std::error::Error for StatsError {}