tmp22/src/errors.rs

38 lines
1.3 KiB
Rust

//! Error datatypes
use derive_more::{Display, Error};
/// Errors that can occur when using
#[derive(Debug, PartialEq, Display, Clone, Error)]
#[cfg(not(tarpaulin_include))]
pub enum CaptchaError {
/// when configuring m_captcha, [DefenseBuilder][crate::new_levels::DefenseBuilder] must be passed atleast
/// one `LevelConfig` if not this error will arise
#[display(fmt = "LevelBuilder should have atleaset one level configured")]
LevelEmpty,
/// Visitor count must be an integer
/// when configuring m_captcha, [LevelBuilder][crate::new_levels::LevelBuilder] difficulty_factor
/// must be set to greater than zero.
#[display(fmt = "difficulty factor must be greater than zero")]
DifficultyFactorZero,
/// Difficulty factor must be set
#[display(fmt = "Set difficulty factor")]
SetDifficultyFactor,
/// Visitor count must be set
#[display(fmt = "Set visitor count")]
SetVisitorCount,
/// Visitor count must be Unique
#[display(fmt = "Duplicate visitor count")]
DuplicateVisitorCount,
/// Difficulty factor should increase with level
#[display(fmt = "Difficulty factor should increase with level")]
DecreaseingDifficultyFactor,
}
/// [Result] datatype for m_captcha
pub type CaptchaResult<V> = std::result::Result<V, CaptchaError>;