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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
use std;
use std::fmt;
#[derive(Clone, Debug)]
pub struct Error(pub String);
impl<T: std::error::Error + std::fmt::Display> From<T> for Error {
fn from(e: T) -> Error {
Error(format!("portus err: {}", e))
}
}
#[derive(Debug, Clone)]
pub struct StaleProgramError;
impl std::error::Error for StaleProgramError {
fn description(&self) -> &str {
"this report does not match the current scope"
}
}
impl std::fmt::Display for StaleProgramError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "this report does not match the current scope")
}
}
#[derive(Debug, Clone)]
pub struct InvalidRegTypeError;
impl std::error::Error for InvalidRegTypeError {
fn description(&self) -> &str {
"the requested field is not a report variable, and therefore cannot be accessed in ccp"
}
}
impl std::fmt::Display for InvalidRegTypeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"the requested field is not a report variable, and therefore cannot be accessed in ccp"
)
}
}
#[derive(Debug, Clone)]
pub struct InvalidReportError;
impl std::error::Error for InvalidReportError {
fn description(&self) -> &str {
"the requested field is in scope but was not found in the report"
}
}
impl std::fmt::Display for InvalidReportError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"the requested field is in scope but was not found in the report"
)
}
}
#[derive(Debug, Clone)]
pub struct FieldNotFoundError;
impl std::error::Error for FieldNotFoundError {
fn description(&self) -> &str {
"the requested field was not found in this scope"
}
}
impl std::fmt::Display for FieldNotFoundError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "the requested field was not found in this scope")
}
}