aegis_password_generator/errors.rs
1use thiserror::Error;
2
3/// An error that can occur during password generation or configuration.
4#[derive(Debug, Error, PartialEq)]
5pub enum PasswordError {
6 /// Returned when the password configuration is invalid.
7 #[error("Invalid password configuration: {0}")]
8 InvalidConfig(String),
9
10 /// Returned when password generation fails unexpectedly.
11 #[error("Password generation failed: {0}")]
12 GenerationError(String),
13
14 /// Returned when the requested password length is 0.
15 #[error("Password length must be greater than 0")]
16 LengthTooShort,
17
18 /// Returned when the requested password length exceeds 128.
19 #[error("Password length must be less than or equal to 128")]
20 LengthTooLong
21}