Skip to main content

wireman_config/
error.rs

1#![allow(clippy::module_name_repetitions, clippy::enum_variant_names)]
2use thiserror::Error as ThisError;
3
4use crate::setup::SetupError;
5
6/// The result type for this library
7pub type Result<T> = std::result::Result<T, Error>;
8
9/// The error type
10#[derive(ThisError, Debug)]
11pub enum Error {
12    /// Error while reading the config file
13    #[error("error reading config")]
14    ReadConfigError {
15        filename: String,
16        source: std::io::Error,
17    },
18
19    /// Error while initializing the config file
20    #[error("error during app setup")]
21    SetupError(#[source] SetupError),
22
23    // /// Error while initializing the config file
24    // #[error("error initializing logger")]
25    // InitializeLoggerError(#[source] logger::LoggerError),
26    /// Error  serializing toml-formatted config
27    #[error("error serializing config")]
28    SerializeConfigError(#[source] toml::ser::Error),
29
30    /// Error deserializing toml-formatted config
31    #[error("error deserializing config")]
32    DeserializeConfigError(#[source] toml::de::Error),
33}