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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
use std::error::Error;
use std::fmt::{Display, Formatter};
#[derive(Debug)]
pub enum ChangesetParseError {
HeaderNotFound,
HeaderParsing,
}
impl Display for ChangesetParseError {
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
match self {
ChangesetParseError::HeaderNotFound => write!(fmt, "Header Not Found"),
ChangesetParseError::HeaderParsing => write!(fmt, "Header Parsing Error"),
}
}
}
impl Error for ChangesetParseError {}
#[derive(Debug)]
pub struct ChangelogParseError(String);
impl From<String> for ChangelogParseError {
fn from(value: String) -> Self {
ChangelogParseError(value)
}
}
impl Display for ChangelogParseError {
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(fmt, "Could not parse changelog: {}", self.0)
}
}
impl Error for ChangelogParseError {}
#[derive(Debug)]
pub struct ExplorerError;
impl From<std::io::Error> for ExplorerError {
fn from(_: std::io::Error) -> Self {
ExplorerError
}
}
impl Display for ExplorerError {
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(fmt, "ExplorerError")
}
}
impl Error for ExplorerError {}
#[derive(Debug)]
pub struct VersionParseError(String);
impl From<String> for VersionParseError {
fn from(value: String) -> Self {
VersionParseError(value)
}
}
impl Display for VersionParseError {
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(
fmt,
"\"{}\" isn't a version, should be patch/minor/major",
self.0
)
}
}
impl Error for VersionParseError {}
#[derive(Debug)]
pub struct VersionBumpError;
impl Display for VersionBumpError {
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(fmt, "VersionBumpError")
}
}
impl Error for VersionBumpError {}