Skip to main content

ExnMessageResult

Type Alias ExnMessageResult 

Source
pub type ExnMessageResult<T = ()> = ExnResult<T, Message>;
Expand description

A result with a Message exception, defaulting to unit success.

This is ExnResult<T, Message>. Use it for operations that attach message contexts with ResultExt::or_raise(), or return standalone messages with ErrorExt::raise(). Use ExnResult<T> with its erased error type for callback bounds.

use gix_error::{message, ErrorExt, ExnMessageResult};

fn validate(ready: bool) -> ExnMessageResult {
    if !ready {
        return Err(message("not ready").raise());
    }
    Ok(())
}

validate(true)?;
assert_eq!(validate(false).expect_err("not ready").error().message, "not ready");

Aliased Type§

pub enum ExnMessageResult<T = ()> {
    Ok(T),
    Err(Exn<Message>),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Exn<Message>)

Contains the error value