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
#[derive(Debug)]
pub enum Error {
Io(std::io::Error),
Parse(String),
ExtractionBR(String),
ExtractionSE(String),
Ring,
#[cfg(feature = "demon")]
MissingGate,
#[cfg(feature = "demon")]
Apocalypse(apocalypse::Error),
Dummy
}
impl std::fmt::Display for Error {
fn fmt(&self, formatter: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
let content = match self {
Error::Io(inner_error) => format!("io error: {}", inner_error),
Error::Parse(detail) => format!("parse error: {}", detail),
Error::ExtractionBR(detail) => format!("extraction bad request: {}", detail),
Error::ExtractionSE(detail) => format!("extraction server error: {}", detail),
Error::Ring => format!("ring error"),
#[cfg(feature = "demon")]
Error::MissingGate => format!("for demon spawning, a gate must be provided to the server through the builder"),
#[cfg(feature = "demon")]
Error::Apocalypse(inner_error) => format!("apocalypse error, {}", inner_error),
Error::Dummy => format!("Dummy error")
};
write!(formatter, "{}", content)
}
}
impl std::error::Error for Error {}