32 lines
706 B
Rust
32 lines
706 B
Rust
|
|
use thiserror::Error;
|
||
|
|
|
||
|
|
/// Core error types for the mailer system.
|
||
|
|
#[derive(Debug, Error)]
|
||
|
|
pub enum MailerError {
|
||
|
|
#[error("invalid email address: {0}")]
|
||
|
|
InvalidEmail(String),
|
||
|
|
|
||
|
|
#[error("invalid email format: {0}")]
|
||
|
|
InvalidFormat(String),
|
||
|
|
|
||
|
|
#[error("missing required field: {0}")]
|
||
|
|
MissingField(String),
|
||
|
|
|
||
|
|
#[error("MIME encoding error: {0}")]
|
||
|
|
MimeError(String),
|
||
|
|
|
||
|
|
#[error("validation error: {0}")]
|
||
|
|
ValidationError(String),
|
||
|
|
|
||
|
|
#[error("parse error: {0}")]
|
||
|
|
ParseError(String),
|
||
|
|
|
||
|
|
#[error("IO error: {0}")]
|
||
|
|
Io(#[from] std::io::Error),
|
||
|
|
|
||
|
|
#[error("regex error: {0}")]
|
||
|
|
Regex(#[from] regex::Error),
|
||
|
|
}
|
||
|
|
|
||
|
|
pub type Result<T> = std::result::Result<T, MailerError>;
|