1use gamlss_core::ModelError;
2use gamlss_spline::{FourierError, SplineError};
3use thiserror::Error;
4
5#[derive(Debug, Clone, PartialEq, Error)]
7pub enum FormulaError {
8 #[error("unknown column `{0}`")]
10 UnknownColumn(String),
11
12 #[error("column `{name}` has {actual} rows, expected {expected}")]
15 ColumnLength {
16 name: String,
18 expected: usize,
20 actual: usize,
22 },
23
24 #[error("column `{name}` does not support requested type `{requested}`")]
26 UnsupportedColumnType {
27 name: String,
29 requested: &'static str,
31 },
32
33 #[error("column `{name}` contains non-finite value at row {row}")]
35 NonFiniteValue {
36 name: String,
38 row: usize,
40 },
41
42 #[error("weights column `{name}` has invalid value at row {row}")]
44 InvalidWeight {
45 name: String,
47 row: usize,
49 },
50
51 #[error("response column `{name}` has invalid {family} value at row {row}")]
53 InvalidResponseDomain {
54 name: String,
56 family: &'static str,
58 row: usize,
60 },
61
62 #[error("column `{name}` has unknown category `{level}` at row {row}")]
64 UnknownCategoryLevel {
65 name: String,
67 level: String,
69 row: usize,
71 },
72
73 #[error("model spec is missing a response column")]
75 MissingResponse,
76
77 #[error("data view must contain at least one row")]
79 EmptyData,
80
81 #[error("parameter `{0}` terms were specified more than once")]
83 DuplicateParameter(&'static str),
84
85 #[error(transparent)]
87 Spline(#[from] SplineError),
88
89 #[error(transparent)]
91 Fourier(#[from] FourierError),
92
93 #[error(transparent)]
95 Model(#[from] ModelError),
96}