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
use thiserror::Error as ThisError;
#[non_exhaustive]
#[derive(ThisError, Debug)]
pub enum ConfigError {
#[error("Cannot find config directory")]
CannotFindConfig,
#[error("I/O error: {0}")]
IoError(#[from] std::io::Error),
#[error("Invalid TOML: {0}")]
InvalidTOML(#[from] toml::de::Error),
#[error("MediaWiki API error: {0}")]
APIError(#[from] mwapi_errors::Error),
#[cfg(unix)]
#[error("Configuration is readable by other users (mode: {0:o}), make it only readable to you, e.g. `chmod 600 mwbot.toml`")]
ReadableConfig(u32),
#[cfg(unix)]
#[error("Configuration is readable by the world (mode: {0:o}), make it only readable to your group, e.g. `chmod 640 mwbot.toml`")]
WorldReadableConfig(u32),
}