1use std::error::Error;
2use std::fmt::{Display, Formatter};
3
4#[derive(Debug)]
5pub enum ChangesetParseError {
6 HeaderNotFound,
7 HeaderParsing,
8}
9
10impl Display for ChangesetParseError {
11 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
12 match self {
13 ChangesetParseError::HeaderNotFound => write!(fmt, "Header Not Found"),
14 ChangesetParseError::HeaderParsing => write!(fmt, "Header Parsing Error"),
15 }
16 }
17}
18
19impl Error for ChangesetParseError {}
20
21#[derive(Debug)]
22pub struct ChangelogParseError(String);
23
24impl From<String> for ChangelogParseError {
25 fn from(value: String) -> Self {
27 ChangelogParseError(value)
28 }
29}
30
31impl Display for ChangelogParseError {
32 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
34 write!(fmt, "Could not parse changelog: {}", self.0)
35 }
36}
37
38impl Error for ChangelogParseError {}
39
40#[derive(Debug)]
41pub struct ExplorerError;
42
43impl From<std::io::Error> for ExplorerError {
44 fn from(_: std::io::Error) -> Self {
45 ExplorerError
46 }
47}
48
49impl Display for ExplorerError {
50 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
52 write!(fmt, "ExplorerError")
53 }
54}
55
56impl Error for ExplorerError {}
57
58#[derive(Debug)]
59pub struct VersionParseError(String);
60
61impl From<String> for VersionParseError {
62 fn from(value: String) -> Self {
64 VersionParseError(value)
65 }
66}
67
68impl Display for VersionParseError {
69 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
71 write!(
72 fmt,
73 "\"{}\" isn't a version, should be patch/minor/major",
74 self.0
75 )
76 }
77}
78
79impl Error for VersionParseError {}
80
81#[derive(Debug)]
82pub struct VersionBumpError;
83
84impl Display for VersionBumpError {
85 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
87 write!(fmt, "VersionBumpError")
88 }
89}
90
91impl Error for VersionBumpError {}
92
93#[derive(Debug)]
94pub enum PluginLoadError {
95 IncompatibleVersion,
96}
97
98impl Display for PluginLoadError {
99 fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
100 match self {
101 PluginLoadError::IncompatibleVersion => write!(fmt, "Incompatible Plugin Version"),
102 }
103 }
104}
105
106impl Error for PluginLoadError {}