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
68
69
70
71
72
73
74
use crate::*;
use crate::nodes::SourceRange;
type Rows = usize;
type Cols = usize;
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct MechError {
pub id: u64,
pub kind: MechErrorKind,
pub msg: String,
}
pub type ParserErrorReport = Vec<ParserErrorContext>;
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct ParserErrorContext {
pub cause_rng: SourceRange,
pub err_message: String,
pub annotation_rngs: Vec<SourceRange>,
}
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum MechErrorKind {
MissingTable(TableId), MissingBlock(BlockId), PendingTable(TableId), DimensionMismatch(Vec<(Rows,Cols)>), LinearSubscriptOutOfBounds((Rows,Rows)), DuplicateAlias(u64), MissingFunction(u64), ZeroIndex, BlockDisabled,
IoError,
GenericError(String),
FileNotFound(String),
Unhandled,
UnknownFunctionArgument(u64),
UnknownColumnKind(u64),
UnhandledFunctionArgumentKind(ValueKind),
UnhandledTableShape(TableShape),
TooManyInputArguments(usize,usize), ParserError(nodes::ParserNode, ParserErrorReport, String),
None,
}
impl From<std::io::Error> for MechError {
fn from(n: std::io::Error) -> MechError {
MechError{msg: "".to_string(), id: 74892, kind: MechErrorKind::IoError}
}
}