Skip to main content

serenade_mailer/
error.rs

1//! Mailer errors.
2
3/// Failure while building or sending an email message.
4#[derive(Debug, thiserror::Error, Clone, PartialEq, Eq)]
5pub enum MailerError {
6    /// Address is empty or not a plausible mailbox.
7    #[error("invalid address: {message}")]
8    InvalidAddress {
9        /// Reason text.
10        message: String,
11    },
12    /// Message has no From address.
13    #[error("email has no From address")]
14    MissingSender,
15    /// Message has no To / Cc / Bcc recipient.
16    #[error("email has no recipient")]
17    MissingRecipient,
18    /// Transport backend failed.
19    #[error("mailer transport: {message}")]
20    Transport {
21        /// Reason text.
22        message: String,
23    },
24    /// Local I/O failed (for example file transport).
25    #[error("mailer io: {message}")]
26    Io {
27        /// Reason text.
28        message: String,
29    },
30}