missing_controller_error

Function missing_controller_error 

Source
pub fn missing_controller_error(
    error_type: ControllerErrorType,
    message: impl Into<String>,
) -> impl FnOnce() -> ControllerError
Expand description

Helper function for .ok_or_else() to create ControllerError on None.

This function creates a closure that generates a ControllerError with the specified error type and message when called.

§Examples

// Instead of:
.ok_or_else(|| ControllerError::new(ControllerErrorType::NotFound, "Item not found".to_string(), None))

// You can write:
.ok_or_else(missing_controller_error(ControllerErrorType::NotFound, "Item not found".to_string()))