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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
extern crate mentat_query;
use mentat_core::{
EdnParseError,
ValueType,
ValueTypeSet,
};
use self::mentat_query::{
PlainSymbol,
};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum BindingError {
NoBoundVariable,
UnexpectedBinding,
RepeatedBoundVariable,
ExpectedBindRel,
ExpectedBindRelOrBindColl,
InvalidNumberOfBindings { number: usize, expected: usize },
}
error_chain! {
types {
Error, ErrorKind, ResultExt, Result;
}
foreign_links {
EdnParseError(EdnParseError);
}
errors {
UnsupportedArgument {
description("unexpected FnArg")
display("unexpected FnArg")
}
InputTypeDisagreement(var: PlainSymbol, declared: ValueType, provided: ValueType) {
description("input type disagreement")
display("value of type {} provided for var {}, expected {}", provided, var, declared)
}
UnrecognizedIdent(ident: String) {
description("no entid found for ident")
display("no entid found for ident: {}", ident)
}
UnknownFunction(name: PlainSymbol) {
description("no such function")
display("no function named {}", name)
}
InvalidNumberOfArguments(function: PlainSymbol, number: usize, expected: usize) {
description("invalid number of arguments")
display("invalid number of arguments to {}: expected {}, got {}.", function, expected, number)
}
UnboundVariable(name: PlainSymbol) {
description("unbound variable in order clause or function call")
display("unbound variable: {}", name)
}
InvalidBinding(function: PlainSymbol, binding_error: BindingError) {
description("invalid binding")
display("invalid binding for {}: {:?}.", function, binding_error)
}
GroundBindingsMismatch {
description("mismatched bindings in ground")
display("mismatched bindings in ground")
}
InvalidGroundConstant {
description("invalid expression in ground constant")
display("invalid expression in ground constant")
}
InvalidArgument(function: PlainSymbol, expected: &'static str, position: usize) {
description("invalid argument")
display("invalid argument to {}: expected {} in position {}.", function, expected, position)
}
InvalidArgumentType(function: PlainSymbol, expected_types: ValueTypeSet, position: usize) {
description("invalid argument")
display("invalid argument to {}: expected one of {:?} in position {}.", function, expected_types, position)
}
InvalidLimit(val: String, kind: ValueType) {
description("invalid limit")
display("invalid limit {} of type {}: expected natural number.", val, kind)
}
NonMatchingVariablesInOrClause {
description("non-matching variables in 'or' clause")
display("non-matching variables in 'or' clause")
}
NonMatchingVariablesInNotClause {
description("non-matching variables in 'not' clause")
display("non-matching variables in 'not' clause")
}
DuplicateVariableError(name: PlainSymbol, clause: &'static str) {
description("duplicate variables")
display("{} var {} is duplicated", clause, name)
}
UnknownLimitVar(name: PlainSymbol) {
description(":limit var not present in :in")
display(":limit var {} not present in :in", name)
}
}
}