filter_expr_evaler/
error.rs1use crate::ValueType;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5 #[error("internal: {0}")]
6 Internal(String),
7
8 #[error("invalid value {0}")]
9 InvalidValue(String),
10
11 #[error("type mismatch: expected same type for comparison, got {0:?} and {1:?}")]
12 TypeMismatch(String, String),
13
14 #[error("failed to get the variable {var:?}: {error}")]
16 FailedToGetVar { var: String, error: String },
17
18 #[error("no such variable {var:?}")]
20 NoSuchVar { var: String },
21
22 #[error("no such function {function:?}")]
24 NoSuchFunction { function: String },
25
26 #[error("no such method {method:?} for type {obj_type:?}")]
28 NoSuchMethod { method: String, obj_type: ValueType },
29
30 #[error(
32 "invalid argument count for function {function:?}: expected {expected} argument(s), but got {got} argument(s)"
33 )]
34 InvalidArgumentCountForFunction {
35 function: String,
36 expected: usize,
37 got: usize,
38 },
39
40 #[error(
42 "invalid argument type for function {function:?}'s index {index} argument: expected {expected:?}, got {got:?}"
43 )]
44 InvalidArgumentTypeForFunction {
45 function: String,
46 index: usize,
47 expected: ValueType,
48 got: ValueType,
49 },
50
51 #[error(
53 "invalid argument count for method {method:?}: expected {expected} argument(s), but got {got} argument(s)"
54 )]
55 InvalidArgumentCountForMethod {
56 method: String,
57 expected: usize,
58 got: usize,
59 },
60
61 #[error(
63 "invalid argument type for method {method:?}'s index {index} argument: expected {expected:?}, got {got:?}"
64 )]
65 InvalidArgumentTypeForMethod {
66 method: String,
67 index: usize,
68 expected: ValueType,
69 got: ValueType,
70 },
71}