antecedent_stats/error.rs
1//! Stats-layer errors.
2//!
3//! SPDX-License-Identifier: MIT OR Apache-2.0
4
5use thiserror::Error;
6
7/// Statistical / linear algebra errors.
8#[derive(Clone, Debug, Eq, PartialEq, Error)]
9#[non_exhaustive]
10pub enum StatsError {
11 /// Shape mismatch.
12 #[error("shape error: {message}")]
13 Shape {
14 /// Context.
15 message: &'static str,
16 },
17 /// Rank deficiency / singular design.
18 #[error("rank deficient: rank={rank} ncols={ncols}")]
19 RankDeficient {
20 /// Detected rank.
21 rank: usize,
22 /// Number of columns.
23 ncols: usize,
24 },
25 /// Materially non-positive variance after inclusion–exclusion (not FP noise).
26 #[error("non-positive variance: {message}")]
27 NonPositiveVariance {
28 /// Context.
29 message: &'static str,
30 },
31 /// Requested option is not implemented on this code path.
32 #[error("unsupported: {message}")]
33 Unsupported {
34 /// Context.
35 message: &'static str,
36 },
37 /// Backend failure.
38 #[error("backend error: {0}")]
39 Backend(String),
40}