]> git.proxmox.com Git - rustc.git/blame - vendor/toml-query/src/error.rs
New upstream version 1.34.2+dfsg1
[rustc.git] / vendor / toml-query / src / error.rs
CommitLineData
2c00a5a8
XL
1/// Error types
2
3error_chain! {
4 types {
5 Error, ErrorKind, ResultExt, Result;
6 }
7
9fa01778
XL
8 foreign_links {
9 TomlSerialize(::toml::ser::Error) #[cfg(feature = "typed")];
10 TomlDeserialize(::toml::de::Error) #[cfg(feature = "typed")];
11 }
12
2c00a5a8
XL
13 errors {
14
15 // Errors for tokenizer
16
17 QueryParsingError(query: String) {
18 description("parsing the query failed")
19 display("Parsing the query '{}' failed", query)
20 }
21
22 EmptyQueryError {
23 description("the query is empty")
24 display("The query on the TOML is empty")
25 }
26
27 EmptyIdentifier {
28 description("Query an empty identifier: ''")
29 display("The passed query has an empty identifier")
30 }
31
32 ArrayAccessWithoutIndex {
33 description("trying to access array without index")
34 display("The passed query tries to access an array but does not specify the index")
35 }
36
37 ArrayAccessWithInvalidIndex {
38 description("trying to pass an invalid index")
39 display("The passed query tries to access an array but does not specify a valid index")
40 }
41
42 // Errors for Resolver
43
44 IdentifierNotFoundInDocument(ident: String) {
45 description("Identifier missing in document")
46 display("The identfier '{}' is not present in the document", ident)
47 }
48
49 NoIndexInTable(i: usize) {
50 description("Cannot deref index from table")
51 display("Got an index query '[{}]' but have table", i)
52 }
53
54 NoIdentifierInArray(s: String) {
55 description("Cannot query identifier in array")
56 display("Got an identifier query '{}' but have array", s)
57 }
58
59 QueryingValueAsTable(s: String) {
60 description("Querying a table where a value is")
61 display("Got an identifier query '{}' but have value", s)
62 }
63
64 QueryingValueAsArray(i: usize) {
65 description("Querying a table where a value is")
66 display("Got an index query '{}' but have value", i)
67 }
68
69 CannotDeleteNonEmptyTable(tabname: Option<String>) {
70 description("Cannot delete Table that is not empty")
71 display("Cannot delete table '{:?}' which is not empty", tabname)
72 }
73
74 CannotDeleteNonEmptyArray(arrname: Option<String>) {
75 description("Cannot delete Array that is not empty")
76 display("Cannot delete array '{:?}' which is not empty", arrname)
77 }
78
79 CannotAccessBecauseTypeMismatch(expected: &'static str, actual: &'static str) {
80 description("Cannot access value because of type mismatch")
81 display("Cannot access {} because expected {}", actual, expected)
82 }
83
84 ArrayIndexOutOfBounds(idx: usize, arrlen: usize) {
85 description("Delete index out of bounds")
86 display("Cannot delete in array at {}, array has length {}", idx, arrlen)
87 }
88
89 TypeError(requested: &'static str, got: &'static str) {
90 description("Type error")
91 display("Type Error. Requested {}, but got {}", requested, got)
92 }
93
94 NotAvailable(query: String) {
95 description("Value missing error")
96 display("Value at '{}' not there", query)
97 }
98
99 }
9fa01778 100
2c00a5a8 101}