Skip to main content

with_cause

Function with_cause 

Source
pub fn with_cause<E>(message: &str, cause: E) -> CuError
where E: Error + Send + Sync + 'static,
Expand description

Creates a CuError with a message and cause in a single call.

This is a convenience function for use with .map_err().

ยงExample

use cu29_traits::with_cause;

let result: Result<(), std::io::Error> = Err(std::io::Error::other("io error"));
let cu_result = result.map_err(|e| with_cause("Failed to read file", e));