antecedent_prob/error.rs
1//! Probability / inference errors.
2//!
3//! SPDX-License-Identifier: MIT OR Apache-2.0
4
5use thiserror::Error;
6
7/// Errors from prior construction, posterior storage, or inference backends.
8#[derive(Clone, Debug, Eq, PartialEq, Error)]
9#[non_exhaustive]
10pub enum ProbError {
11 /// Shape / dimension mismatch.
12 #[error("shape error: {message}")]
13 Shape {
14 /// Context.
15 message: &'static str,
16 },
17 /// Invalid prior or configuration.
18 #[error("invalid prior: {message}")]
19 InvalidPrior {
20 /// Context.
21 message: &'static str,
22 },
23 /// Inference failed to converge or produce a usable approximation.
24 #[error("inference error: {message}")]
25 Inference {
26 /// Context.
27 message: &'static str,
28 },
29 /// Numerical failure (singular Hessian, separation, etc.).
30 #[error("numerical error: {message}")]
31 Numerical {
32 /// Context.
33 message: String,
34 },
35 /// Missing required diagnostics for a reported posterior.
36 #[error("missing diagnostics: {message}")]
37 MissingDiagnostics {
38 /// Context.
39 message: String,
40 },
41}