mwbot/error/config.rs
1/*
2Copyright (C) 2021 Kunal Mehta <legoktm@debian.org>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 3 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18use thiserror::Error as ThisError;
19
20/// Error class for config and setup
21#[non_exhaustive]
22#[derive(ThisError, Debug)]
23pub enum ConfigError {
24 #[error("Error: {0}")]
25 BotError(#[from] crate::error::Error),
26 #[error("Parsoid Error: {0}")]
27 ParsoidError(#[from] parsoid::Error),
28 #[error("Cannot find config directory")]
29 CannotFindConfig,
30 #[error("I/O error: {0}")]
31 IoError(#[from] std::io::Error),
32 #[error("Invalid TOML: {0}")]
33 InvalidTOML(#[from] toml::de::Error),
34 #[error("Configuration is readable by other users: {0}")]
35 ReadableConfig(#[from] fs_mistrust::Error),
36 #[error("At least both of api_url and rest_url, or the wiki_url, must be specified")]
37 MissingSiteURL,
38}