Skip to main content

koth_core/
error.rs

1//! The error type of the in-memory stages and the detection configuration.
2
3use thiserror::Error;
4
5/// Convenience alias for results produced by this crate.
6pub type Result<T, E = Error> = std::result::Result<T, E>;
7
8/// Anything that can go wrong in `koth-core`: reading or validating a
9/// configuration. The messages match the `koth-ms` crate's `KothError` variants
10/// of the same meaning (`Io`, `ConfigError`), which this converts into one to one.
11#[derive(Error, Debug)]
12#[non_exhaustive]
13pub enum Error {
14    /// Reading a configuration file failed.
15    #[error("IO error: {0}")]
16    Io(#[from] std::io::Error),
17
18    /// An invalid or unparseable configuration value.
19    #[error("Config error: {0}")]
20    Config(String),
21}