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
#[derive(Debug)]
pub enum ErrorKind {
Parser,
FromUtf8(std::str::Utf8Error),
IO(std::io::Error),
InvalidPath(String),
RevisionLogFailure(String),
InvalidDateTime(String),
UnknownRequirement(String),
Manifest(String),
}
impl From<std::io::Error> for ErrorKind {
fn from(value: std::io::Error) -> Self {
ErrorKind::IO(value)
}
}
impl From<nom::Err<&[u8]>> for ErrorKind {
fn from(_value: nom::Err<&[u8]>) -> Self {
ErrorKind::Parser
}
}
impl From<chrono::format::ParseError> for ErrorKind {
fn from(value: chrono::format::ParseError) -> Self {
ErrorKind::InvalidDateTime(format!("{:?}", value))
}
}
impl From<std::str::Utf8Error> for ErrorKind {
fn from(value: std::str::Utf8Error) -> Self {
ErrorKind::FromUtf8(value)
}
}