Files
RustBox/src/imap/error.rs
T
Mateusz Gruszczyński a643e7e3ab
RustBox CI / rustbox (push) Waiting to run
v0.0.5
2026-10-30 12:06:44 +01:00

31 lines
885 B
Rust

use std::fmt;
#[derive(Debug)]
pub enum ImapError {
ConnectionFailed(String),
AuthenticationFailed,
FolderNotFound(String),
MessageNotFound { uid: u32, folder: String },
ProtocolError(String),
}
impl fmt::Display for ImapError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ImapError::ConnectionFailed(msg) => write!(f, "Connection failed: {msg}"),
ImapError::AuthenticationFailed => write!(f, "Authentication failed"),
ImapError::FolderNotFound(name) => write!(f, "Folder not found: {name}"),
ImapError::MessageNotFound { uid, folder } => {
write!(f, "Message UID {uid} not found in folder {folder}")
}
ImapError::ProtocolError(msg) => write!(f, "Protocol error: {msg}"),
}
}
}
impl std::error::Error for ImapError {}