torrust_tracker_configuration/validator.rs
1//! Trait to validate semantic errors.
2//!
3//! Errors could involve more than one configuration option. Some configuration
4//! combinations can be incompatible.
5use thiserror::Error;
6
7/// Errors that can occur validating the configuration.
8#[derive(Error, Debug)]
9pub enum SemanticValidationError {
10 #[error("Private mode section in configuration can only be included when the tracker is running in private mode.")]
11 UselessPrivateModeSection,
12}
13
14pub trait Validator {
15 /// # Errors
16 ///
17 /// Will return an error if the configuration is invalid.
18 fn validate(&self) -> Result<(), SemanticValidationError>;
19}