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
|
/// Error types
pub type Result<T> = ::std::result::Result<T, Error>;
#[derive(Debug, Fail)]
pub enum Error {
#[cfg(feature = "typed")]
#[fail(display = "{}", _0)]
Serialize(#[cause] ::serde::ser::Error),
#[cfg(feature = "typed")]
#[fail(display = "{}", _0)]
Deserialize(#[cause] ::serde::de::Error),
// Errors for tokenizer
#[fail(display = "Parsing the query '{}' failed", _0)]
QueryParsingError(String),
#[fail(display = "The query on the document is empty")]
EmptyQueryError,
#[fail(display = "The passed query has an empty identifier")]
EmptyIdentifier,
#[fail(display = "The passed query tries to access an array but does not specify the index")]
ArrayAccessWithoutIndex,
#[fail(
display = "The passed query tries to access an array but does not specify a valid index"
)]
ArrayAccessWithInvalidIndex,
// Errors for Resolver
#[fail(display = "The identfier '{}' is not present in the document", _0)]
IdentifierNotFoundInDocument(String),
#[fail(display = "Got an index query '[{}]' but have table", _0)]
NoIndexInTable(usize),
#[fail(display = "Got an identifier query '{}' but have array", _0)]
NoIdentifierInArray(String),
#[fail(display = "Got an identifier query '{}' but have value", _0)]
QueryingValueAsTable(String),
#[fail(display = "Got an index query '{}' but have value", _0)]
QueryingValueAsArray(usize),
#[fail(display = "Cannot delete table '{:?}' which is not empty", _0)]
CannotDeleteNonEmptyTable(Option<String>),
#[fail(display = "Cannot delete array '{:?}' which is not empty", _0)]
CannotDeleteNonEmptyArray(Option<String>),
#[fail(display = "Cannot access {} because expected {}", _0, _1)]
CannotAccessBecauseTypeMismatch(&'static str, &'static str),
#[fail(display = "Cannot delete in array at {}, array has length {}", _0, _1)]
ArrayIndexOutOfBounds(usize, usize),
#[fail(display = "Cannot access array at {}, array has length {}", _0, _1)]
IndexOutOfBounds(usize, usize),
#[fail(display = "Type Error. Requested {}, but got {}", _0, _1)]
TypeError(&'static str, &'static str),
#[fail(display = "Value at '{}' not there", _0)]
NotAvailable(String),
}
|