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

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

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

Conversion to a UTF-8 string at the FFI boundary (Rust/C) failed, with cause attached.

Custom(Box<dyn Error + Send + Sync>)

Tuple Fields

0: 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

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.