1use std::fmt;
4
5#[derive(Debug, Clone)]
6pub enum FakerError {
7 LocaleNotFound(String),
9 DataNotFound(String),
11 UniqueGeneratorExhausted(usize),
13 InvalidArgument(String),
15 RandError(String),
17}
18
19impl fmt::Display for FakerError {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 match self {
22 FakerError::LocaleNotFound(locale) => write!(f, "Locale not found: {}", locale),
23 FakerError::DataNotFound(key) => write!(f, "Data not found: {}", key),
24 FakerError::UniqueGeneratorExhausted(retries) => {
25 write!(f, "Unique generator exhausted after {} retries", retries)
26 }
27 FakerError::InvalidArgument(msg) => write!(f, "Invalid argument: {}", msg),
28 FakerError::RandError(msg) => write!(f, "Random error: {}", msg),
29 }
30 }
31}
32
33impl std::error::Error for FakerError {}