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
use std::fmt::{Display, Formatter};
#[derive(Debug)]
pub enum Error {
Null,
Unsupported,
Ascii,
Format(std::fmt::Error),
IO(std::io::Error),
UTF8(std::str::Utf8Error),
FromUtf8(std::string::FromUtf8Error),
CommandNotFound,
TestFailed,
FileNotFound,
}
impl From<std::fmt::Error> for Error {
fn from(e: std::fmt::Error) -> Self {
Self::Format(e)
}
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Self::IO(e)
}
}
impl From<std::str::Utf8Error> for Error {
fn from(e: std::str::Utf8Error) -> Self {
Self::UTF8(e)
}
}
impl From<std::string::FromUtf8Error> for Error {
fn from(e: std::string::FromUtf8Error) -> Self {
Self::FromUtf8(e)
}
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Interoptopus failed!")
}
}
impl std::error::Error for Error {}