[−][src]Crate err_ctx
Minimalist helper library for providing contextual errors that display in the traditional
"context: cause" format. Useful for cases where the primary goal of a Result
is to convey
detailed diagnostics to a user.
Pairs well with type Result<T> = std::result::Result<T, Box<std::error::Error + Send + Sync>>;
use std::fs; use err_ctx::ResultExt; let result = fs::read("foo.txt").ctx("reading foo.txt"); assert!(result.unwrap_err().to_string().starts_with("reading foo.txt: "));
Structs
Context | An error providing context for some underlying cause. |
Traits
ErrorExt | |
ResultExt |