Enum milter::Error [−][src]
pub enum Error {
SocketConfig(CString),
TimeoutConfig(i32),
SocketBacklogConfig(i32),
Registration,
Main,
CallbackPanic,
FailureStatus,
FfiCString(NulError),
FfiInt(TryFromIntError),
FfiUtf8(Utf8Error),
Custom(Box<dyn Error + Send + Sync>),
}
Expand description
Various kinds of errors that can occur in a milter application.
Variants
SocketConfig(CString)
Tuple Fields
0: CString
The socket specification provided to the Milter
could not be used.
TimeoutConfig(i32)
Tuple Fields
0: i32
The timeout duration configuration parameter of the Milter
is invalid.
SocketBacklogConfig(i32)
Tuple Fields
0: i32
The socket backlog length configuration parameter of the Milter
is
invalid.
Registration
Registration of the Milter
’s configuration with libmilter failed.
Main
The libmilter library’s event loop (main
function) exited with a
failure status.
CallbackPanic
The libmilter library’s event loop was shut down after a panic in a callback.
FailureStatus
A libmilter function returned the failure status code.
FfiCString(NulError)
Tuple Fields
0: NulError
Conversion to a C-style string at the FFI boundary (Rust/C) failed, with cause attached.
FfiInt(TryFromIntError)
Tuple Fields
Conversion to an integer type at the FFI boundary (Rust/C) failed, with cause attached.
FfiUtf8(Utf8Error)
Tuple Fields
0: Utf8Error
Conversion to a UTF-8 string at the FFI boundary (Rust/C) failed, with cause attached.
Custom(Box<dyn Error + Send + Sync>)
An unspecific error variant, with cause attached.
Examples
This variant is provided as a convenience; use it to propagate arbitrary errors out of a callback.
use milter::{Context, Error, Status};
use std::fs::File;
fn handle_data(_: Context<()>) -> milter::Result<Status> {
let _ = File::create("/tmp/archive").map_err(|e| Error::Custom(e.into()))?;
Ok(Status::Continue)
}
Trait Implementations
Performs the conversion.