Result

Type Alias Result 

Source
pub type Result<T> = Result<T, Error>;
Expand description

Result type alias using our comprehensive Error type.

This provides a convenient way to return results from functions that can fail with any of the layer-specific errors defined in this module.

§Examples

use axum_gate::errors::{Result, Error, PermissionsError};

fn validate_account(user_id: &str) -> Result<()> {
    if user_id.is_empty() {
        return Err(Error::Permissions(PermissionsError::collision(
            12345,
            vec!["invalid".to_string()]
        )));
    }
    Ok(())
}

Aliased Type§

pub enum Result<T> {
    Ok(T),
    Err(Error),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Error)

Contains the error value