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 when callers need direct access to the Message context or exception-tree operations. Other message-based public and private APIs use Result<T>. Construct it with ResultExt::or_raise_typed(), ErrorExt::raise_typed(), or bail!.

use gix_error::{bail, ExnMessageResult};

fn validate(ready: bool) -> ExnMessageResult {
    if !ready {
        bail!("not ready");
    }
    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