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
#[derive(Clone, Copy, PartialEq, Eq, Debug, Fail)]
pub enum AnalysisError {
#[fail(display = "Missing profile required for the analysis.")]
MissingProfile,
#[fail(display = "Missing value required for analysis.")]
MissingValue,
#[fail(display = "Not enough data available for analysis.")]
NotEnoughData,
#[fail(display = "Profile is full of missing values, cannot do analysis.")]
NoDataProfile,
#[fail(display = "Invalid input.")]
InvalidInput,
}
pub type Result<T> = ::std::result::Result<T, AnalysisError>;
impl AnalysisError {
#[allow(missing_docs)]
pub fn tag(self, file: &str, line: u32) -> Self {
if cfg!(debug_assertions) {
println!(
"\n******\n\n\nError initiated in {} on line {}: {}\n\n\n******",
file, line, self
);
}
self
}
}