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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
use std::{io, num::TryFromIntError, time::SystemTimeError};
use chrono::ParseError;
use indicatif::style::TemplateError;
use reqwest::StatusCode;
use crate::db::DBError;
pub type MLE<T> = Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("io: {source}")]
Io {
#[from]
source: io::Error,
},
#[error("tryfromint: {source}")]
TryFromInt {
#[from]
source: TryFromIntError,
},
#[error("serde_json: {source}")]
Json {
#[from]
source: serde_json::Error,
},
#[error("reqwest: {source}")]
Reqwest {
#[from]
source: reqwest::Error,
},
#[error("chrono parse error: {source}")]
ChronoParse {
#[from]
source: ParseError,
},
#[error("config: {source}")]
Config {
#[from]
source: config::ConfigError,
},
#[error("indicatif template: {source}")]
IndicatifTemplate {
#[from]
source: TemplateError,
},
#[error("toml: {source}")]
TomlSer {
#[from]
source: toml::ser::Error,
},
#[error("toml: {source}")]
TomlDeser {
#[from]
source: toml::de::Error,
},
#[error("systemtime: {source}")]
Systemtime {
#[from]
source: SystemTimeError,
},
#[error("conversion: {source}")]
Conversion {
#[from]
source: ConversionError,
},
#[error("Request didn't return 200 OK ({0})")]
RequestNotOK(StatusCode),
#[error("ModError ({0})")]
ModError(String),
#[error("No file extension where one should be")]
NoFileExtension,
#[error("Desired path not found")]
PathNotFound,
#[error("Desired system directory {0} not found")]
SysDirNotFound(String),
#[error("No requested Minecraft version found")]
MinecraftVersionNotFound,
#[error("Mod already added")]
ModAlreadyOnList,
#[error("No versions are applicable for the current scope")]
NoCurrentVersion,
#[error("The version does not know if it's locked or not")]
VersionSetNotSet,
#[error("No download for the current id found")]
NoDownload,
#[error("No ProjectInfo found / no id given")]
NoProjectInfo,
#[error("The requested List was not found")]
ListNotFound,
#[error("No download folder given")]
NoDownloadFolder,
#[error("db: {source}")]
DB {
#[from]
source: DBError,
},
}
#[derive(Debug, thiserror::Error)]
pub enum ConversionError {
#[error("couldn't convert to Modloader from: {0}")]
Modloader(String),
#[error("Path couldn't be converted to string")]
InvalidPath,
}
|