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
use std::error::Error as StdError;
impl StdError for Error {}
use std::fmt;
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::File { path } => write!(f, "Error reading file '{}'", path),
Error::Parse => write!(f, "Error wile parsing document"),
Error::Include { path } => write!(f, "Error including document at '{}'", path),
Error::TooManyIncludes => write!(f, "Error processing deep includes"),
Error::IncludeNotAllowedFromStr => {
write!(f, "Error processing includes from a str source")
}
Error::DisabledExternalUrl => write!(
f,
"Error including document with External URL as feature has been disabled"
),
Error::KeyNotFound { key } => write!(f, "Error looking for key '{}'", key),
Error::MissingKey => write!(f, "Error getting a value because key is not present"),
Error::InvalidKey => write!(f, "Error getting a value because of an invalid key type"),
Error::Deserialization { message } => write!(f, "Error deserializing: {}", message),
}
}
}
#[derive(Debug, Clone, PartialEq)]
pub enum Error {
File {
path: String,
},
Parse,
Include {
path: String,
},
TooManyIncludes,
IncludeNotAllowedFromStr,
DisabledExternalUrl,
KeyNotFound {
key: String,
},
MissingKey,
InvalidKey,
Deserialization {
message: String,
},
}