1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use std::{error::Error, fmt::Display};
pub type Result<T> = std::result::Result<T, AnalysisError>;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum AnalysisError {
MissingProfile,
MissingValue,
NotEnoughData,
NoDataProfile,
InvalidInput,
InterpolationError,
MetForError,
}
impl Display for AnalysisError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
use crate::AnalysisError::*;
match self {
MissingProfile => write!(f, "missing profile required for the analysis"),
MissingValue => write!(f, "missing value required for analysis"),
NotEnoughData => write!(f, "not enough data available for analysis"),
NoDataProfile => write!(f, "profile is full of missing values, cannot do analysis"),
InvalidInput => write!(f, "invalid input"),
InterpolationError => write!(f, "none value encountered during interpolation"),
MetForError => write!(f, "error bubbled up from metfor crate"),
}
}
}
impl Error for AnalysisError {}