rust_persian_tools/number_plate/
errors.rs

1use thiserror::Error;
2
3#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
4#[derive(Error, Debug, PartialEq, Eq, Clone, Hash)]
5pub enum PlateNumberError {
6    #[error("Plate numbers must be 7 or 8 digits long.")]
7    InvalidPlateDigitLength,
8    #[error("Invalid plate character length. Motorcycles should have 7 characters, and cars should have 8.")]
9    InvalidPlateCharacterLength,
10    #[error("Invalid plate character: {0}")]
11    InvalidPlateCharacter(String),
12    #[error("Invalid motorcycle province code: {0:?}")]
13    MotorcycleProvinceNotFound(String),
14    #[error("Invalid car province code: {0:?}")]
15    CarProvinceNotFound(String),
16}