gam_problem/
custom_family_error.rs1use thiserror::Error;
4
5use crate::{IdentifiabilityAudit, MapUniquenessError};
6
7#[derive(Debug, Clone, Error)]
8pub enum CustomFamilyError {
9 #[error("custom-family invalid input in {context}: {reason}")]
10 InvalidInput {
11 context: &'static str,
12 reason: String,
13 },
14 #[error("custom-family optimization error in {context}: {reason}")]
15 Optimization {
16 context: &'static str,
17 reason: String,
18 },
19 #[error("{reason}")]
20 DimensionMismatch { reason: String },
21 #[error("{reason}")]
22 NumericalFailure { reason: String },
23 #[error("{reason}")]
24 ConstraintViolation { reason: String },
25 #[error("{reason}")]
26 UnsupportedConfiguration { reason: String },
27 #[error("{reason}")]
28 BasisDecompositionFailed { reason: String },
29 #[error("identifiability audit refused the fit: {}", audit.summary)]
39 IdentifiabilityFailure { audit: IdentifiabilityAudit },
40 #[error("MAP estimate non-unique: {}", error)]
47 MapUniquenessFailure { error: MapUniquenessError },
48}
49
50impl From<String> for CustomFamilyError {
51 fn from(value: String) -> Self {
52 Self::InvalidInput {
53 context: "custom-family string boundary",
54 reason: value,
55 }
56 }
57}
58
59impl From<CustomFamilyError> for String {
60 fn from(value: CustomFamilyError) -> Self {
61 value.to_string()
62 }
63}