commit
bc5fbd6ba9
180 files changed
+63750
No files matched your search
@@ -0,0 +1,37 @@
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum SieveError {
|
||||
ConnectionFailed(String),
|
||||
TlsFailed(String),
|
||||
AuthenticationFailed(String),
|
||||
InsecureAuthenticationBlocked,
|
||||
Protocol(String),
|
||||
ServerRejected(String),
|
||||
Timeout,
|
||||
ScriptTooLarge,
|
||||
}
|
||||
|
||||
impl fmt::Display for SieveError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::ConnectionFailed(msg) => write!(f, "ManageSieve connection failed: {msg}"),
|
||||
Self::TlsFailed(msg) => write!(f, "ManageSieve TLS failed: {msg}"),
|
||||
Self::AuthenticationFailed(msg) => {
|
||||
write!(f, "ManageSieve authentication failed: {msg}")
|
||||
}
|
||||
Self::InsecureAuthenticationBlocked => write!(
|
||||
f,
|
||||
"ManageSieve plaintext authentication is blocked; use STARTTLS/implicit TLS or explicitly enable SIEVE_ALLOW_INSECURE_AUTH"
|
||||
),
|
||||
Self::Protocol(msg) => write!(f, "ManageSieve protocol error: {msg}"),
|
||||
Self::ServerRejected(msg) => {
|
||||
write!(f, "ManageSieve server rejected the command: {msg}")
|
||||
}
|
||||
Self::Timeout => write!(f, "ManageSieve operation timed out"),
|
||||
Self::ScriptTooLarge => write!(f, "Sieve script exceeds the RustBox 0.0.1 size limit"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for SieveError {}
|
||||
Reference in new issue
Block a user